From 9dc90333c1875a7ccef37aac0ae3a4f1e59c38a2 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 6 Aug 2013 18:05:15 +0200 Subject: [PATCH 1/8] Only generate excerpts if the excerpt_separator isn't blank --- lib/jekyll/post.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 9ad25399..86541b78 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 should_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 should_generate_excerpt? + Jekyll::Excerpt.new(self) + else + "" + end + end + + def should_generate_excerpt? + site.config['excerpt_separator'].to_s != "" end end end From 5817d5a37231d62e3927a3fe16781145c5471483 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 6 Aug 2013 18:08:22 +0200 Subject: [PATCH 2/8] We don't need excerpts in jekyllrb.com --- site/_config.yml | 1 + 1 file changed, 1 insertion(+) 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: From 3af0e2ea4c274e830972e1f2222a67ef077d05d6 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 6 Aug 2013 18:08:58 +0200 Subject: [PATCH 3/8] bugs in the site --- site/_posts/2013-07-24-jekyll-1-1-1-released.markdown | 2 +- site/docs/configuration.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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
From cb8bc5accc8cc540dfb00adb9581c4ff741e55e3 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 6 Aug 2013 18:15:06 +0200 Subject: [PATCH 4/8] Just clarifying the Post#should_generate_excerpt? --- lib/jekyll/post.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 86541b78..683d5543 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -319,7 +319,7 @@ module Jekyll end def should_generate_excerpt? - site.config['excerpt_separator'].to_s != "" + !(site.config['excerpt_separator'].to_s == "") end end end From a73b17d08c75fc287982e42970a95f6f13d3804f Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 6 Aug 2013 18:24:47 +0200 Subject: [PATCH 5/8] Docs about disabling excerpts. --- site/docs/posts.md | 3 ++- site/docs/troubleshooting.md | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) 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.

From ccedcd0eb99fb977aedc91de4fd7c3e1e86a805e Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 7 Aug 2013 17:12:13 +0200 Subject: [PATCH 6/8] Use .empty? instead of == '' --- lib/jekyll/post.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 683d5543..60aa8fd7 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -319,7 +319,7 @@ module Jekyll end def should_generate_excerpt? - !(site.config['excerpt_separator'].to_s == "") + !(site.config['excerpt_separator'].to_s.empty?) end end end From 95534733ed19177116ad061df1963e4c650c6451 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Thu, 8 Aug 2013 00:35:42 +0200 Subject: [PATCH 7/8] should_generate_excerpt? ~> generate_excerpt? --- lib/jekyll/post.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 60aa8fd7..98ad1c65 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -255,7 +255,7 @@ module Jekyll "page" => self.to_liquid(EXCERPT_ATTRIBUTES_FOR_LIQUID) }.deep_merge(site_payload) - if should_generate_excerpt? + if generate_excerpt? self.extracted_excerpt.do_layout(payload, {}) end @@ -311,14 +311,14 @@ module Jekyll protected def extract_excerpt - if should_generate_excerpt? + if generate_excerpt? Jekyll::Excerpt.new(self) else "" end end - def should_generate_excerpt? + def generate_excerpt? !(site.config['excerpt_separator'].to_s.empty?) end end From 3c12495b0025fc26231b4a8875aee5ec98fee5fa Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Wed, 7 Aug 2013 20:22:32 -0500 Subject: [PATCH 8/8] Add test for disabled excerpts --- test/test_excerpt.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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