首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >为什么jekyll在分页时失败了?

为什么jekyll在分页时失败了?
EN

Stack Overflow用户
提问于 2018-06-08 04:03:20
回答 1查看 495关注 0票数 0

我想在我的Jekyll站点上启用分页,但是发生了这种情况:

代码语言:javascript
复制
jekyll serve
WARN: Unresolved specs during Gem::Specification.reset:
      eventmachine (>= 0.12.9)
      listen (~> 3.0)
      rouge (< 4, >= 1.7)
      rb-fsevent (>= 0.9.4, ~> 0.9)
      rb-inotify (>= 0.9.7, ~> 0.9)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
Configuration file: /Users/sean/dev/sh78.github.io/_config.yml
            Source: /Users/sean/dev/sh78.github.io
       Destination: /Users/sean/dev/sh78.github.io/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
  Liquid Exception: Liquid syntax error (line 1): Unknown tag 'paginator' in log/index.html
jekyll 3.8.3 | Error:  Liquid syntax error (line 1): Unknown tag 'paginator'

我想我是跟着the docs发球了:

_config.yml

代码语言:javascript
复制
plugins:
 - jekyll-feed
 - jekyll-seo-tag
 - jekyll-paginate

paginate: 2
paginate_path: "/log/page:num/"

按照paginate_path中的定义,index.html文件已就位

代码语言:javascript
复制
ls
404.html      README.md     _posts/       favicon.ico
Gemfile       _config.yml   _sass/        favicon.png
Gemfile.lock  _includes/    _site/        index.md
LICENSE.txt   _layouts/     assets/       log/

ls log/
index.html

log/index.html的内容,我尝试在其中至少打印paginator.posts对象。根据文档,前面的内容中没有永久链接:

代码语言:javascript
复制
---
layout: log
title: log
icon: pencil-alt
description: >
  Sean's blog. Articles about software and other things.
---

{% paginator.posts %}

以下是父log (博客)模板:

代码语言:javascript
复制
---
layout: default
---

<div class="blog">

  {{ content }}

  {%- if site.posts.size > 0 -%}
  {% comment %} *truncated* (it works fine) {% endcomment %}

我的Gemfile中有jekyll-paginate

代码语言:javascript
复制
# If you have any plugins, put them here!
group :jekyll_plugins do
  gem "jekyll-feed", "~> 0.6"
  gem "jekyll-paginate"
end

并成功运行了bundle install

代码语言:javascript
复制
bundle install
Using public_suffix 3.0.2
Using addressable 2.5.2
Using bundler 1.16.2
Using colorator 1.1.0
Using concurrent-ruby 1.0.5
Using eventmachine 1.2.7
Using http_parser.rb 0.6.0
Using em-websocket 0.5.1
Using ffi 1.9.25
Using forwardable-extended 2.6.0
Using i18n 0.9.5
Using rb-fsevent 0.10.3
Using rb-inotify 0.9.10
Using sass-listen 4.0.0
Using sass 3.5.6
Using jekyll-sass-converter 1.5.2
Using ruby_dep 1.5.0
Using listen 3.1.5
Using jekyll-watch 2.0.0
Using kramdown 1.17.0
Using liquid 4.0.0
Using mercenary 0.3.6
Using pathutil 0.16.1
Using rouge 3.1.1
Using safe_yaml 1.0.4
Using jekyll 3.8.3
Using jekyll-feed 0.9.3
Using jekyll-paginate 1.1.0
Using jekyll-seo-tag 2.5.0
Using minimaterialize 1.1.2
Bundle complete! 5 Gemfile dependencies, 30 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

我卸载了所有版本的jekyll,除了正在使用的版本,比如this answer

我也尝试了像this answer中的gem cleanup && bundle exec jekyll serve一样,得到了上面列出的相同的异常。

环境:

代码语言:javascript
复制
jekyll -v
WARN: Unresolved specs during Gem::Specification.reset:
      eventmachine (>= 0.12.9)
      listen (~> 3.0)
      rouge (< 4, >= 1.7)
      rb-fsevent (>= 0.9.4, ~> 0.9)
      rb-inotify (>= 0.9.7, ~> 0.9)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
jekyll 3.8.3

ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]

gem -v
2.5.1

我遗漏了什么?

EN

回答 1

Stack Overflow用户

发布于 2018-06-08 10:17:26

嗯,是的,我犯了个错误。我把paginator写成一个liquid标签,也就是命令(像if),而不仅仅是调用一个变量/对象。

{% paginator %}更改为{{ paginator }}是解决方案。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50749368

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档