gpt4 book ai didi

blogs - 使用 Jekyll 在主页上显示最新的博客文章

转载 作者:行者123 更新时间:2023-12-01 02:23:28 26 4
gpt4 key购买 nike

我正在尝试使用 Jekyll 在主页上显示最新的博客文章。所有帖子 + 分页器功能在 localhost:4000/blog/ 上运行良好,但我想在主页上重复这一点。我见过的唯一其他答案是在 this gist ,我无法理解。

最佳答案

您复制的代码段有什么问题?

它的工作原理如下:在 index.html ,它检索第一篇博文( site.posts.first )并将其存储在 post 中变量,而其内容存储在 content .毕竟,它调用 ( include ) post_detail.html部分,它使用与以前相同的上下文。

所以,最后,它使用了 post 中的第一篇文章( content 变量)及其内容( post_detail.html 变量)。部分的。

希望有帮助!

关于blogs - 使用 Jekyll 在主页上显示最新的博客文章,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18464138/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com