Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby Jekyll 3中的分页未生成页面_Ruby_Pagination_Jekyll - Fatal编程技术网

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提供的解决方案,它成功了!非常感谢