Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用OSS+CDN部署网站分类子页面链接缺少index.html #2021

Closed
ibaoger opened this issue Jun 25, 2016 · 8 comments · Fixed by apollographql/apollo-server#619
Closed

Comments

@ibaoger
Copy link

ibaoger commented Jun 25, 2016

使用OSS+CDN部署网站,CND通常不支持默认目录指向 index.html,这种情况下,分类,标签页显示都会指向到首页;

配置文件中提供了首页、分类、标签、关于、归档等一级子页面的链接添加 index.html 方法,但分类子页面内的链接并未提供此方法;

例如:
访问分类页的链接是 https://abc.com/categories/index.html (访问正常)
访问分类页内元素的链接是 https://abc.com/categories/def/ (访问 404)

@ibaoger
Copy link
Author

ibaoger commented Jun 25, 2016

目前使用修改源码的方法简单的修复分类和标签子页面链接不包含index.html的问题,希望作者能提供配置文件配置的方法

lib/plugins/helper/list_categories.js

result += '<a class="' + className + '-list-link' + (isCurrent ? ' current' : '') + '" href="' + self.url_for(cat.path) + '">';
--->
result += '<a class="' + className + '-list-link' + (isCurrent ? ' current' : '') + '" href="' + self.url_for(cat.path) + 'index.html">';

result += '<a class="' + className + '-link" href="' + self.url_for(cat.path) + '">';
--->
result += '<a class="' + className + '-link" href="' + self.url_for(cat.path) + 'index.html">';

lib/plugins/helper/list_tags.js

result += '<a class="' + className + '-list-link" href="' + self.url_for(tag.path) + '">';
--->
result += '<a class="' + className + '-list-link" href="' + self.url_for(tag.path) + 'index.html">';

result += '<a class="' + className + '-link" href="' + self.url_for(tag.path) + '">';
--->
result += '<a class="' + className + '-link" href="' + self.url_for(tag.path) + 'index.html">';

影响:分类和标签子页面内的链接(添加index.html);

@Xuanwo
Copy link
Contributor

Xuanwo commented Jul 2, 2016

@shishuo365 ,已经添加了,使用方法为list_categorieslist_tags中添加参数suffix: index.html,文档稍后更新。

Xuanwo added a commit to hexojs/site that referenced this issue Jul 2, 2016
@ibaoger
Copy link
Author

ibaoger commented Jul 3, 2016

请问,添加参数suffix的操作位于哪个文件?

@Xuanwo
Copy link
Contributor

Xuanwo commented Jul 3, 2016

主题里面,用到list_categories函数的地方。
你需要使用线上的最新版本,npm里面的还不支持。

@ibaoger
Copy link
Author

ibaoger commented Jul 3, 2016

好的

@ibaoger
Copy link
Author

ibaoger commented Jul 22, 2016

又发现翻页链接没有 index.html ;

@czboosj
Copy link

czboosj commented Oct 25, 2016

{{ list_categories() }} next 主题中这个函数中加参数吗 ,3.22版本的hexo, 加上参数后hexo g 失败

@ibaoger
Copy link
Author

ibaoger commented May 22, 2017

@Xuanwo 标签云 tagcloud 也需要支持参数suffix: index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants