【问题标题】:Can't get pagination to work with Jekyll in /archive/ directory无法在 /archive/ 目录中使用 Jekyll 进行分页
【发布时间】:2016-06-15 00:28:38
【问题描述】:

我已经解决了之前关于 Jekyll 和分页的问题,但没有任何建议有效。我有这个:

_config.yml
gems:
  - jekyll-paginate
paginate: 5 # amount of posts to show
paginate_path: archive/page:num/

archive.html
---
 layout: archive
 permalink: /archive/
 author_profile: true
---
{% include base_path %}

<h3 class="archive__subtitle">{{ site.data.ui-text[site.locale].recent_posts }}</h3>

{% for post in paginator.posts %}
  {% include archive-single.html %}
{% endfor %}

{% include paginator.html %}

这最终会在 /archive/ 中生成一个格式非常精美的存档页面,其中包含零个帖子。我的帖子确实有固定链接,我不知道是不是这个问题。子目录创建正确,但存档页面找不到它们。

请注意,如果我将它放在 index.html 中效果很好,但我希望在前面有一个启动页面,其中包含指向帖子存档页面的链接,这似乎可行但不起作用。

请不要将此称为重复项。我已经阅读了关于同一件事的其他 10 篇文章,但由于某种原因它无法正常工作。

这是 Jekyll 3.1.6

【问题讨论】:

  • 我建议您仅使用少量帖子构建网站,并从这些帖子中删除永久链接。他们在文档中明确指出永久链接会破坏分页 - jekyllrb.com/docs/pagination
  • 我从所有帖子中删除了永久链接,但结果仍然相同。
  • GitHub 上有代码吗?如果没有,您能否在初始站点(jekyll 新站点名称)上重现相同的行为并在 GitHub 上发布代码?
  • github.com/synedra/minimal-mistakes - 在此先感谢 :-)
  • 现在正要克隆 repo,发现您已更改为 jekyll-archive gem。那么解决了吗?

标签: jekyll jekyll-paginator


【解决方案1】:

切换到解决问题的 jeckyll-archives。

【讨论】:

  • 您能详细说明一下吗?看起来你正在使用jekyll-paginate 插件和jekyll-archive,就像我一样。我无法在存档页面上显示分页。如果您有一个工作示例,将不胜感激。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-12-30
  • 2015-10-16
  • 2013-03-03
  • 1970-01-01
  • 2014-01-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多