Ruby Jekyll 3中的分页未生成页面
我在创建网站时遇到了分页问题;根据使用此插件时的命令Ruby Jekyll 3中的分页未生成页面,ruby,pagination,jekyll,Ruby,Pagination,Jekyll,我在创建网站时遇到了分页问题;根据使用此插件时的命令c'paginator',它似乎是一个nil变量: 此外,如果我在blog/index.html中将“site.posts”替换为“paginator.posts”,则不会收到任何帖子。我正在运行Ruby 2.4和Jekyll 3.3.1 我的设置如下: \u config.yml gems: - jekyll-autoprefixer - jekyll-paginate plugins_dir: [jekyll
c'paginator'
,它似乎是一个nil变量:
此外,如果我在blog/index.html中将“site.posts”替换为“paginator.posts”,则不会收到任何帖子。我正在运行Ruby 2.4和Jekyll 3.3.1
我的设置如下:
\u config.yml
gems:
- jekyll-autoprefixer
- jekyll-paginate
plugins_dir: [jekyll-autoprefixer, jekyll-paginate]
paginate: 3
paginate_path: "/blog/page:num/"
include: [ "_pages", "_posts" ]
---
layout: page
title: Blog
subtitle: Blog posts
permalink: blog/index.html
---
{% for post in site.posts %}
<h1 class="post-title"> {{post.title}} </h1>
{% endfor %}
{% debug %}
<h1 class="post-title"> {{ paginator.total_posts }} </h1>
\u pages/blog/index.html
gems:
- jekyll-autoprefixer
- jekyll-paginate
plugins_dir: [jekyll-autoprefixer, jekyll-paginate]
paginate: 3
paginate_path: "/blog/page:num/"
include: [ "_pages", "_posts" ]
---
layout: page
title: Blog
subtitle: Blog posts
permalink: blog/index.html
---
{% for post in site.posts %}
<h1 class="post-title"> {{post.title}} </h1>
{% endfor %}
{% debug %}
<h1 class="post-title"> {{ paginator.total_posts }} </h1>
(为了简洁起见,删除了大多数文件)
谢谢你的帮助 如果您将
\u pages
重命名为pages
,您是否可以尝试从blog/index.html文件的前面删除永久链接:“permalink:blog/index.html”我与OP有相同的问题。然后我使用@Kuma提供的解决方案,它成功了!非常感谢