MOxFIVE / hexo-theme-yelee

简而不减 Hexo 双栏博客主题; Another simple and elegant theme for Hexo.
http://moxfive.xyz/
1.38k stars 328 forks source link

网站在子目录下链接地址错乱 #171

Open maobaolong opened 7 years ago

maobaolong commented 7 years ago

主题配置中的root_url配置成/blog/ 博客目录的root和url也相应配置到blog子目录。 发现标签,关于等都不对了,链接地址里有重复blog,搜索出的结果也重复blog。

maobaolong commented 7 years ago

补充说明,这是我的博客hexo工程 https://github.com/maobaolong/maobaolong

https://maobaolong.github.io/github_blog

Vccxx commented 6 years ago

同样的问题,求解

maobowen commented 6 years ago

Some suggestions:

To fix "Tags" and "About me", change layout/_partial/left-col.ejs, line 73:

- <li><a href="<%- theme.root_url %><%- url_for(theme.menu[i]) %>"><%= i %></a></li>
+ <li><a href="<%- url_for(theme.menu[i]) %>"><%= i %></a></li>

To fix floating homepage buttons on the left side of the posts, change layout/_partial/post-nav-button.ejs, line 9 and 19:

- <a href="/" title="<%= __('tooltip.back2home') %>"><i class="fa fa-home"></i></a>
+ <a href="<%- url_for('/') %>" title="<%= __('tooltip.back2home') %>"><i class="fa fa-home"></i></a>

To fix the "Author" link in the copyright section, change layout/_partial/post/nav.ejs, line 4:

- <p><span><%= __('copyright_info.author') %>:</span><a href="/" title="<%= __('tooltip.back2home') %>"><%=theme.author%></a></p>
+ <p><span><%= __('copyright_info.author') %>:</span><a href="<%- url_for('/') %>" title="<%= __('tooltip.back2home') %>"><%=theme.author%></a></p>

The reason is that the function url_for() has already taken care of the root directory. Read more: https://hexo.io/docs/helpers.html#url-for

I've so far encountered those errors, but if there are other errors the solutions will be similar. Hope the author's gonna fix it soon.