Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG:第一次hexo generate不生成categories #38

Open
yqs112358 opened this issue Nov 15, 2024 · 3 comments
Open

BUG:第一次hexo generate不生成categories #38

yqs112358 opened this issue Nov 15, 2024 · 3 comments

Comments

@yqs112358
Copy link

yqs112358 commented Nov 15, 2024

有关Issue:#32 #37

观察到:清除所有post的categories后,第一次执行hexo generate或者hexo serve,生成的网站中categories为空,以后再执行generate或serve则产生正常结果。

问题在于,插件通过重写data.full_source来设置自动识别的categories,但是第一次hexo generate后修改的full_source在本次generate过程中不会生效,因为markdown已经被parse过并传递给插件处理了,修改了源文件中的categories后要到下一次generate时才会被识别到。而github pages / cf pages只会执行一次generate,因此在类似云部署环境中,插件无法生效。

可能需要通过强制更新data.categories,或者强制重新读取一次Post来解决此问题

@xu-song
Copy link
Owner

xu-song commented Nov 15, 2024

这个问题能复现吗?解决了吗

@yqs112358
Copy link
Author

能复现,挺好复现的😂
随便hexo init创建一个博客,塞一点不写category的post进去,然后generate,或者serve
第一次生成出来的category页面是空的

@yqs112358
Copy link
Author

yqs112358 commented Nov 15, 2024

刚刚尝试过直接在代码里面覆写data.categories,但是覆写完好像生效不了,emm,感觉不太好弄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants