hexojs / hexo

A fast, simple & powerful blog framework, powered by Node.js.
https://hexo.io
MIT License
38.83k stars 4.75k forks source link

hexo.locals.get('posts'),只能获取三篇文章?"hexo.locals.get('posts')" only retrieves three articles? #5377

Closed iloveyz closed 6 months ago

iloveyz commented 6 months ago

Check List

Expected behavior

我希望通过{% tagName post link ID %}短标签在文章中显示其它文章,然而在我使用输出hexo.locals.get('posts')时,发现最多只找到了三篇文章。就导致了我想显示更多文章而无法正常显示。请问怎么解决?(我使用了abbrlink插件,但在我测试过程中,abbrlink是正常工作的,而且每篇文章也都正确生成了对应的abbrlink,而且我的文章不止三篇)。另:在我尝试修复错误的过程中,发现如果编辑文章内{% %}短标签,好像就正常能获取了。请问该如何解决,非常感谢。(备注:hexo已更新到最新版本,abbrlink也是最新版本)

I hope to display other articles in a post using the {% tagName post link ID %} short tag. However, when I use hexo.locals.get('posts'), I find that it only retrieves up to three articles, preventing me from displaying more articles as intended. I am using the abbrlink plugin, and in my testing, abbrlink works correctly, with each article having the corresponding abbrlink generated. Also, my site has more than three articles. Additionally, I observed that when I edit an article with {% %} short tags, it seems to work correctly. How can I resolve this issue? Your assistance is greatly appreciated. (Note: Hexo and abbrlink are both updated to the latest versions.)

Actual behavior

hexo.locals.get('posts'),只能获取三篇文章! "hexo.locals.get('posts')" only retrieves three articles!

How to reproduce?

var allPosts = hexo.locals.get('posts'); console.log(allPosts)

"console.log(allPosts)" 只显示了三篇文章 "console.log(allPosts)" only displays three articles.

Is the problem still there under Safe mode?

yes

Your Node.js & npm version

No response

Your Hexo and Plugin version

No response

Your package.json

No response

Your site's _config.yml (Optional)

No response

Others

No response

D-Sketon commented 6 months ago

also see #5287

iloveyz commented 6 months ago

also see #5287

Thank you for your response. I'm not sure how to resolve this. It seems to persist and hasn't been effective. I've searched for other issues, and it appears that quite a few people are facing the same problem. However, the root cause remains unclear.

jerryc127 commented 6 months ago

https://github.com/orgs/hexojs/discussions/5230

We have all encountered it, it should be a bug

uiolee commented 6 months ago

Duplicate of #5287