Fix: 在首页点击分页,导航栏首页按钮不激活 Bug
This commit is contained in:
parent
2bafb70e10
commit
ab9c262579
|
@ -18,7 +18,7 @@
|
|||
<ul class="menu-list">
|
||||
<% for (let i in theme.menu) { %>
|
||||
<li class="menu-item">
|
||||
<a class="<%- is_current(theme.menu[i]) ? 'current' : '' %>"
|
||||
<a class="<%- isInHomePaging(page.path, theme.menu[i]) ? 'current' : is_current(theme.menu[i]) ? 'current' : '' %>"
|
||||
href="<%- url_for(theme.menu[i]) %>"><%= __(i.toLowerCase()) %></a>
|
||||
</li>
|
||||
<% } %>
|
||||
|
|
|
@ -2,8 +2,16 @@
|
|||
* Hexo 扩展:辅助函数(Helper)
|
||||
* 补充复杂的业务逻辑
|
||||
* https://hexo.io/zh-cn/api/helper.html
|
||||
* 用法:<%= helper_test('xxx') %>
|
||||
* eg 用法:<%= helper_test('xxx') %>
|
||||
*/
|
||||
hexo.extend.helper.register('helper_test', function (character) {
|
||||
return character + '😁';
|
||||
});
|
||||
|
||||
hexo.extend.helper.register('isInHomePaging', function (pagePath, route) {
|
||||
if (pagePath.length > 5 && route === '/' ) {
|
||||
return pagePath.slice(0, 5) === 'page/';
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue