首页 文章

Jekyll要求在YAML Front Matter中“摘录”液体标签

提问于
浏览
0

我有一个基于Jekyll 3.0.1 based on this Kasper theme的博客,并进行了一些修改 . 我有've removed all the posts but one in an effort to reduce the degrees of freedom in the problem I' . 该网站 Build 很好,当我包括"excerpt"标签和's YAML front matter, but when I remove this I get an error (shown below). I' VE使用在_config.yml文件的"excerpt_separator"标签和值,并把分离器,后尝试了门柱内侧为它的值,但是这并未't help. Just for the hell of it I even put in a default 1137413 tag and value inside the _config.yml and this didn'牛逼帮助的 . 在我看来,我的Jekyll安装不再适当地自动生成摘录,因为当我在帖子的YAML前端手动包含"excerpt"时它确实构建了 .

这是Github存储库:https://github.com/jtelszasz/kasper-trial

users-MacBook-Air:kasper-trial user$ jekyll serve --trace
Configuration file: /Users/user/Documents/kasper-trial/_config.yml
Source: /Users/user/Documents/kasper-trial
Destination: /Users/user/Documents/kasper-trial/_site
Incremental build: disabled. Enable with --incremental
Generating... 
Deprecation: Collection#map should be called on the #docs array directly.
Called by /Users/user/Documents/kasper-trial/_plugins/rssgenerator.rb:46:in `block in generate'.
Deprecation: Collection#count should be called on the #docs array directly.
Called by /Users/user/Documents/kasper-trial/_plugins/rssgenerator.rb:49:in `rescue in block in generate'.
Deprecation: Collection#reverse should be called on the #docs array directly.
Called by /Users/user/Documents/kasper-trial/_plugins/rssgenerator.rb:51:in `block in generate'.
Deprecation: Document#title is now a key in the #data hash.
Called by /Users/user/Documents/kasper-trial/_plugins/rssgenerator.rb:53:in `block (3 levels) in generate'.
/usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.0.1/lib/jekyll/document.rb:471:in `method_missing': undefined method `excerpt' for #<Jekyll::Document _posts/2015-11-30-blah.md collection=posts> (NoMethodError)
from /Users/user/Documents/kasper-trial/_plugins/rssgenerator.rb:55:in `block (3 levels) in generate'
from /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/rss/maker/base.rb:57:in `new_item'
from /Users/user/Documents/kasper-trial/_plugins/rssgenerator.rb:52:in `block (2 levels) in generate'
from /Users/user/Documents/kasper-trial/_plugins/rssgenerator.rb:51:in `each'
from /Users/user/Documents/kasper-trial/_plugins/rssgenerator.rb:51:in `block in generate'
from /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/rss/maker/base.rb:438:in `make'
from /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/rss/maker/base.rb:402:in `make'
from /usr/local/Cellar/ruby/2.2.3/lib/ruby/2.2.0/rss/maker.rb:28:in `make'
from /Users/user/Documents/kasper-trial/_plugins/rssgenerator.rb:41:in `generate'
from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.0.1/lib/jekyll/site.rb:154:in `block in generate'
from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.0.1/lib/jekyll/site.rb:153:in `each'
from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.0.1/lib/jekyll/site.rb:153:in `generate'
from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.0.1/lib/jekyll/site.rb:58:in `process'
from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.0.1/lib/jekyll/command.rb:28:in `process_site'
from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.0.1/lib/jekyll/commands/build.rb:60:in `build'
from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.0.1/lib/jekyll/commands/build.rb:35:in `process'
from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.0.1/lib/jekyll/commands/serve.rb:26:in `block (2 levels) in init_with_program'
from /usr/local/lib/ruby/gems/2.2.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `call'
from /usr/local/lib/ruby/gems/2.2.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `block in execute'
from /usr/local/lib/ruby/gems/2.2.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `each'
from /usr/local/lib/ruby/gems/2.2.0/gems/mercenary-0.3.5/lib/mercenary/command.rb:220:in `execute'
from /usr/local/lib/ruby/gems/2.2.0/gems/mercenary-0.3.5/lib/mercenary/program.rb:42:in `go'
from /usr/local/lib/ruby/gems/2.2.0/gems/mercenary-0.3.5/lib/mercenary.rb:19:in `program'
from /usr/local/lib/ruby/gems/2.2.0/gems/jekyll-3.0.1/bin/jekyll:17:in `<top (required)>'
from /usr/local/bin/jekyll:23:in `load'
from /usr/local/bin/jekyll:23:in `<main>'

1 回答

  • 0

    您在 _plugins/rssgenerator.rb 第55行遇到问题 .

    item.description = parser.convert(post.excerpt)
    

    应该 :

    item.description = parser.convert(post.to_liquid['excerpt'])
    

    删除它并使用标准的jekyll文件生成您的Feed(find it here) .

    在_config.yml中添加:

    excerpt_separator: "<!--excerpt-->"
    

    你的帖子:

    ---
    layout: post
    title: Post Title
    description: "blah."
    modified: 2014-12-17
    category: articles
    tags: [futbol]
    ---
    excerpt
    
    <!--excerpt-->
    
    asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf
    

相关问题