jekyll日志列表分页问题调试


本人环境配置

ruby: 2.3.1p112
jekyll: 3.4.0
gem: 2.6.7

问题描述

当在 _config.yml 中添加 gems: - jekyll-paginate, 会提示如下错误

$ jekyll build                                                            
WARN: Unresolved specs during Gem::Specification.reset:
      listen (< 3.1, ~> 3.0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
Configuration file: /path/to/itaken.github.io/_config.yml
  Dependency Error: Yikes! It looks like you don't have jekyll-paginate or one of its dependencies installed. In order to use Jekyll as currently configured, you'll need to install this gem. The full error message from Ruby is: 'cannot load such file -- jekyll-paginate' If you run into trouble, you can find helpful resources at https://jekyllrb.com/help/!
jekyll 3.4.0 | Error:  jekyll-paginate

使用 gem 安装 jekyll-paginate (sudo gem install jekyll-paginate)也没有解决.

查看gem 是否存在多个 jekyll, 然而并没有 ^1

$ gem uninstall jekyll                                                    1 ↵

You have requested to uninstall the gem:
    jekyll-3.4.0
    ...

尝试 安装 github-pages, 发现 该插件同时安装了 jekyll 3.3.1, 需要 uninstall 其中一个 jekyll,

如果 删除 支持的 jekyll版本, 则会报错, 需要从新安装.

$ sudo gem uninstall jekyll

Select gem to uninstall:
 1. jekyll-3.3.1
 2. jekyll-3.4.0
 3. All versions
> 1
Successfully uninstalled jekyll-3.3.1

解决方法

在 Gemfile中 添加 gem "jekyll-paginate", "~> 1.1" 即可.

jekyll genfile config

问题描述

Gemfile中添加了jekyll-paginate, 根据官方文档进行配置, 还是存在问题 ^2

$ jekyll server
WARN: Unresolved specs during Gem::Specification.reset:
      listen (< 3.1, ~> 3.0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
Configuration file: /path/to/itaken.github.io/_config.yml
Configuration file: /path/to/itaken.github.io/_config.yml
            Source: /path/to/itaken.github.io
       Destination: /path/to/itaken.github.io/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
        Pagination: Pagination is enabled, but I couldn't find an index.html page to use as the pagination template. Skipping pagination.
                    done in 1.391 seconds.
 Auto-regeneration: enabled for '/path/to/itaken.github.io'
Configuration file: /path/to/itaken.github.io/_config.yml
    Server address: http://127.0.0.1:4000/
  Server running... press ctrl-c to stop.

而且 我的index文件是.md 而并非 .html 的. ^3

修改 paginate_path 也没有效果. ^4

解决方法

直接将 index.md 修改为 index.html 即可.

反而是index.md文件不能加载jekyll-paginate,无法使用翻页, 真奇了一大怪.


挺喜欢Google搜索的提示的:
google notice


参考文档


Author: Itaken
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint polocy. If reproduced, please indicate source Itaken !
  TOC目录