阿里云oss部署hexo不支持自动跳转到index.html页面,所以如果需要部署到阿里云oss上,那么需要做以下修改。
创建“标签”页面 生成 tags.html
新建“标签”页面
1
hexo new page tags
给标签页面添加类型
我们在source文件夹中的tags文件夹下找到index.md文件,在它的头部加上type属性。1
2
3
4
5---
title: tags
date: 2018-08-06 22:48:29
type: "tags"
---将index.md文件重命名为 tags.md并挪到 tags的父文件夹下,删除tags文件夹
创建“分类”页面 生成categories.html
这里和上一步骤基本一致
新建分类页面
1
hexo new page categories
给分类页面添加类型
我们在source文件夹中的categories文件夹下找到index.md文件,在它的头部加上type属性。1
2
3
4
5---
title: 文章分类
date: 2017-05-27 13:47:40
type: "categories"
---将index.md文件重命名为 categories.md并挪到 categories的父文件夹下,删除categories文件夹
创建about.html
参考以上两个步骤
文章页面
在_config.yml中,修改
1 | permalink: :year/:month/:day/:title/ |
为
1 | permalink: post/:urlname.html |
其中 urlname为在文章中指定当前文件的永久链接,如
1 | --- |
修改文章归档首页的访问地址
修改 主题文件夹下的 _config.yml 配置文件
1 | menu: |
这里修改之后会出现 点击归档页菜单栏的时候 菜单没有处于选中状态
修改 主题文件夹下 scripts/helpers/engine.js
1 | var current = this.url_for(canonical).replace('index.html', '', 'g'); |
为
1 | var current = this.url_for(canonical); |
问题解决
修改hexo的分页
%d/index.html 变为 %d.html
hexo生成的分页 静态文件路径
如 archives/page/2/index.html
修改成 archives/page/2.html
修改 node_modules/hexo-pagination/lib/pagination.js
1 | //var format = options.format || 'page/%d/'; |
修改分页插件生成的分页链接

修改 node_modules\hexo\lib\plugins\helper\paginator.js
1 | function link(i) { |
修改分类页的链接 形如 categories/Spring-Cloud-%E5%85%A5%E9%97%A8%E6%95%99%E7%A8%8B/index.html
修改 node_modules\hexo\lib\plugins\helper\list_categories.js
1 | const suffix = options.suffix || 'index.html'; |
修改标签页的链接 形如 tags/Spring-Cloud/index.html
修改 node_modules\hexo\lib\plugins\helper\tagcloud.js
1 | result.push( |
修改文章内容页里的 分类和标签 链接
修改 主题文件夹下 layout/_macro/post.swig
1 | <a href="{{ url_for(cat.path) }}index.html" itemprop="url" rel="index"> |
1 | <a href="{{ url_for(tag.path) }}index.html" rel="tag"># {{ tag.name }}</a> |
到这里,所有的链接都是以 html后缀 打开