修复自定义post-index标签不高亮问题 (#304)
This commit is contained in:
parent
6516b2a68e
commit
dae9a259a3
|
@ -40,7 +40,9 @@ function layoutDiv() {
|
||||||
if (theme['post-index']) {
|
if (theme['post-index']) {
|
||||||
const obj = theme['post-index'];
|
const obj = theme['post-index'];
|
||||||
for (let key of Object.keys(obj)) {
|
for (let key of Object.keys(obj)) {
|
||||||
if (full_url_for(page.path) == full_url_for(obj[key])) {
|
// 当 page 的末尾为 index.html 或者处于该 page 的某个子页面时也应该匹配
|
||||||
|
// if (full_url_for(page.path) == full_url_for(obj[key])) {
|
||||||
|
if (full_url_for(page.path).startsWith(full_url_for(obj[key]))){
|
||||||
el += '<a class="active" href="' + url_for(obj[key]) + '">' + key + '</a>';
|
el += '<a class="active" href="' + url_for(obj[key]) + '">' + key + '</a>';
|
||||||
} else {
|
} else {
|
||||||
el += '<a href="' + url_for(obj[key]) + '">' + key + '</a>';
|
el += '<a href="' + url_for(obj[key]) + '">' + key + '</a>';
|
||||||
|
@ -54,4 +56,4 @@ function layoutDiv() {
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<%- layoutDiv() %>
|
<%- layoutDiv() %>
|
Loading…
Reference in New Issue