有撰写博客时,有一些文章尚在撰写或者仅用于个人记录,需要进行隐藏,本文进行此功能的设置:

使用插件

插件:hexo-hide-posts

1
npm install hexo-hide-posts

Config.yml配置

_config.yml中添加以下内容:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
hide_posts:
# Should hexo-hide-posts be enabled.
enable: true

# The front-matter key for flagging hidden posts.
# You can change the filter name if you like.
filter: hidden

# Add "noindex" meta tag to prevent hidden posts from being indexed by search engines.
noindex: true

# Generators in the allowlist will have access to the hidden posts.
# Common generators in Hexo: 'index', 'tag', 'category', 'archive', 'sitemap', 'feed'
# allowlist_generators: []

# Generators in the blocklist can *not* access the hidden posts.
# The allowlist has higher priority than the blocklist, if both set.
# blocklist_generators: ['*']

文章Front-Matter设置

如果想要将文章隐藏掉,只需要在Front-Matter中添加hidder: true即可,如下图:

这样就可以将目标文章隐藏掉了,主页,归档,标签都不会出现相关信息。不过需要注意直接用url还是可以访问的。

(这个不建议搭配abbrlink,可能会被爆破的,不过应该没人这么无聊吧哈哈哈~