$ yarn add hexo-hide-posts yarn add v1.22.5 warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json. [1/4] Resolving packages... [2/4] Fetching packages... info fsevents@2.3.2: The platform "win32" is incompatible with this module. info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation. [3/4] Linking dependencies... [4/4] Building fresh packages... success Saved lockfile. success Saved 3 new dependencies. info Direct dependencies ├─ hexo-generator-index-pin-top@0.2.2 └─ hexo-hide-posts@0.2.0 info All dependencies ├─ hexo-generator-index-pin-top@0.2.2 ├─ hexo-hide-posts@0.2.0 └─ object-assign@4.1.1 Done in 19.27s.
配置
在站点目录下的_config.yml中如下配置:
1 2 3 4 5 6 7 8 9 10
# hexo-hide-posts hide_posts: enable:true # Change the filter name to fit your need filter:hidden # Generators which you want to expose all posts (include hidden ones) to. # Common generators: index, tag, category, archive, sitemap, feed, etc. public_generators: [] # Add "noindex" meta tag to prevent hidden posts from being indexed by search engines noindex:true