hexo隐藏首页文章

本文最后更新于:2 年前

今天从新整了下hexo,谷歌了半天隐藏首页文章,最后发现自己原来老早之前写过这个博客?果然我的记忆力约等于无。

声明

本文档的一切内容均为本地测试结果,受限于本人知识与能力,仅供参考,如因参照本文档操作而发生任何问题,无论是否严格参照本文档操作,请恕本人概不负责。

文档中的任何观点受限于本人知识、能力及眼界,不保证理智,公正,客观。如本文档中观点与您相左,以您的意见为准。

前言

用的插件,且插件的文档写的很好了

hexo-generator-index2原文档链接

下面是搬运的内容

安装

1
2
npm install hexo-generator-index2 --save
npm uninstall hexo-generator-index --save

hexo-generator-index2可以完全替代官方的hexo-generator-index,所以安装之后,先卸载官方的插件,不然会引起一些冲突。

选项

1
2
3
4
5
6
7
8
9
10
11
# index2 generator是否包含官方的hexo-generator-index,默认true(包含)
index2_include_index: true # defult is true

# 配置index2 generator,可以是数组或对象
index2_generator:
per_page: 10
order_by: -date
include:
- category Web # 只包含Web分类下的文章
exclude:
- tag Hexo # 不包含标签为Hexo的文章

per_page: Posts displayed per page. (0 = disable pagination)

order_by: Posts order. (Order by date descending by default)

layout: Set the layout, default is index

path: Output path, if path is ‘’, means output to the root directory (http://127.0.0.1:4000/ )

index: Home index or not, if true and the path is ‘’, same to offical hexo-generator-index

include: Posts filter include option

exclude: Posts filter exclude option

除了include和exclude,其它如per_page和order_by都是原有的官方首页生成器选项,不必更改。

Include/exclude 选项格式为属性 值(注意,属性与值中间有个英文的空格),可选的属性有:

category: 文章分类

tag: 文章标签

path: 文章源路径


hexo隐藏首页文章
https://www.jingshan256.com/hexo_hide_posts/
作者
origincat
发布于
2019年9月8日
许可协议