diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 9ad25399..98ad1c65 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -255,7 +255,9 @@ module Jekyll "page" => self.to_liquid(EXCERPT_ATTRIBUTES_FOR_LIQUID) }.deep_merge(site_payload) - self.extracted_excerpt.do_layout(payload, {}) + if generate_excerpt? + self.extracted_excerpt.do_layout(payload, {}) + end do_layout(payload.merge({"page" => self.to_liquid}), layouts) end @@ -309,7 +311,15 @@ module Jekyll protected def extract_excerpt - Jekyll::Excerpt.new(self) + if generate_excerpt? + Jekyll::Excerpt.new(self) + else + "" + end + end + + def generate_excerpt? + !(site.config['excerpt_separator'].to_s.empty?) end end end diff --git a/site/_config.yml b/site/_config.yml index ac93b762..91d89f84 100644 --- a/site/_config.yml +++ b/site/_config.yml @@ -2,3 +2,4 @@ pygments: true relative_permalinks: false gauges_id: 503c5af6613f5d0f19000027 permalink: /news/:year/:month/:day/:title +excerpt_separator: diff --git a/site/_posts/2013-07-24-jekyll-1-1-1-released.markdown b/site/_posts/2013-07-24-jekyll-1-1-1-released.markdown index 54e40d86..67958712 100644 --- a/site/_posts/2013-07-24-jekyll-1-1-1-released.markdown +++ b/site/_posts/2013-07-24-jekyll-1-1-1-released.markdown @@ -27,5 +27,5 @@ See the [GitHub Release][] page for more a more detailed changelog for this rele {% endfor %} [GitHub Release]: https://github.com/mojombo/jekyll/releases/tag/v1.1.1 -[gh-pages]: http://pages.github.com +[gh_pages]: http://pages.github.com [v1_1_0]: https://github.com/mojombo/jekyll/releases/tag/v1.1.0 diff --git a/site/docs/configuration.md b/site/docs/configuration.md index 7a72394f..956433e8 100644 --- a/site/docs/configuration.md +++ b/site/docs/configuration.md @@ -236,7 +236,7 @@ before your site is served. Jekyll runs with the following configuration options by default. Unless alternative settings for these options are explicitly specified in the -[[configuration]] file or on the command-line, Jekyll will run using these options. +configuration file or on the command-line, Jekyll will run using these options.
There are two unsupported kramdown options
diff --git a/site/docs/posts.md b/site/docs/posts.md index ed048f10..3dc74710 100644 --- a/site/docs/posts.md +++ b/site/docs/posts.md @@ -133,7 +133,8 @@ posts: {% endhighlight %} If you don't like the automatically-generated post excerpt, it can be overridden by adding -`excerpt` to your post's YAML front-matter. +`excerpt` to your post's YAML front-matter. Completely disable it by setting +your `excerpt_separator` to `""`. ## Highlighting code snippets diff --git a/site/docs/troubleshooting.md b/site/docs/troubleshooting.md index 8ac580e5..6ea19bd9 100644 --- a/site/docs/troubleshooting.md +++ b/site/docs/troubleshooting.md @@ -136,6 +136,14 @@ following error: '{{ "{{" }}' was not properly terminated with regexp: /\}\}/ (Liquid::SyntaxError) {% endhighlight %} +### Excerpts + +Since v1.0.0, Jekyll has had automatically-generated post excerpts. Since +v1.1.0, Jekyll also passes these excerpts through Liquid, which can cause +strange errors where references don't exist or a tag hasn't been closed. If you +run into these errors, try setting `excerpt_separator: ""` in your +`_config.yml`, or set it to some nonsense string. +
Please report issues you encounter!

If you come across a bug, please create an issue on GitHub describing the problem and any work-arounds you find so we can document it here for others.

diff --git a/test/test_excerpt.rb b/test/test_excerpt.rb index a72d1bd2..234d51ba 100644 --- a/test/test_excerpt.rb +++ b/test/test_excerpt.rb @@ -10,6 +10,22 @@ class TestExcerpt < Test::Unit::TestCase post.render(layouts, {"site" => {"posts" => []}}) end + context "With extraction disabled" do + setup do + clear_dest + stub(Jekyll).configuration do + Jekyll::Configuration::DEFAULTS.merge({'excerpt_separator' => ''}) + end + @site = Site.new(Jekyll.configuration) + @post = setup_post("2013-07-22-post-excerpt-with-layout.markdown") + end + + should "not be generated" do + excerpt = @post.send(:extract_excerpt) + assert_equal true, excerpt.empty? + end + end + context "An extracted excerpt" do setup do clear_dest