xaoxuu / hexo-theme-stellar

内置文档系统的简约商务风Hexo主题,支持大量的标签组件和动态数据组件。
https://xaoxuu.com/wiki/stellar/
MIT License
1.21k stars 306 forks source link

关于archives生成器中获取文章的问题 #407

Open sicl5300 opened 4 months ago

sicl5300 commented 4 months ago

检查清单

问题描述

我使用了 hexo-hide-posts 插件来隐藏文章,这个插件按照Generator的scope处理隐藏:

  1. 先从 site.posts 中删除所有隐藏文章
  2. 再对“允许展示隐藏文章”的generator构建一个新的 query,该query中包含全部文章。 https://github.com/prinsss/hexo-hide-posts/blob/9e536b033d2a16dc943ffeb27b2ba7ed47616a5f/lib/injectGenerators.js#L51

然而,archives.ejs中用的是全局变量site.posts,第二步根本影响不到。如果archives中能使用page.posts就好了,但是这需要额外处理pagination。

sicl5300 commented 4 months ago

我这问题提的请奇葩的,因为需求就很怪:cry:——我只想在index内隐藏文章。

我认为只有我一个人能遇到这问题,如果您认为这不适合修改我就不会继续打扰您了。

xaoxuu commented 4 months ago

是在主页隐藏文章还是归档页隐藏?

sicl5300 commented 4 months ago

主页隐藏,归档页不隐藏

github-actions[bot] commented 4 months ago

:wave: Hello, Your suggestion is great, we will add this feature in subsequent versions, thank you very much!

:wave: 您好, 您的建议很棒,我们将会在后续版本中加入这个功能,非常感谢!