杰基尔要求"摘录" YAML Front Matter中的液体标签

时间:2015-12-01 12:41:59

标签: html ruby jekyll liquid

我有一个基于Jekyll 3.0.1 based on this Kasper theme的博客,并进行了一些修改。我已经删除了所有帖子,但其中一个是为了降低我遇到的问题的自由度。当我包含一个"摘录"在帖子的YAML前端内部标记和它的值,但当我删除它时,我得到一个错误(如下所示)。我尝试过使用" excerpt_separator" _config.yml文件中的标记和值,并将分隔符放在帖子中,但这没有帮助。只是为了它的地狱我甚至提出了默认"摘录" _config.yml中的标记和值,这也没有帮助。在我看来,我的Jekyll安装不再适当地自动生成摘录,因为当我手动包含一个"摘录"在帖子的YAML前面的事情。

这是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 :(得分: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