Do not process Liquid in post excerpt when disabled in front matter (#7146)

Merge pull request 7146
This commit is contained in:
Ken Salomon 2018-07-20 19:22:44 -04:00 committed by jekyllbot
parent 02a2f9460a
commit 5701087e7b
2 changed files with 19 additions and 0 deletions

View File

@ -70,3 +70,21 @@ Feature: Post excerpts
And the "_site/2007/12/31/entry1.html" file should exist
And I should see "<p>content for entry1.</p>" in "_site/index.html"
And I should see "<html><head></head><body><p>content for entry1.</p>\n</body></html>" in "_site/2007/12/31/entry1.html"
Scenario: Excerpts from posts having 'render_with_liquid' in their front matter
Given I have an "index.html" page that contains "{% for post in site.posts %}{{ post.excerpt }}{% endfor %}"
And I have a _posts directory
And I have a _layouts directory
And I have a post layout that contains "{{ page.excerpt }}"
And I have the following posts:
| title | layout | render_with_liquid | date | content |
| Unrendered Post | post | false | 2017-07-06 | Liquid is not rendered at {{ page.url }} |
| Rendered Post | post | true | 2017-07-06 | Liquid is rendered at {{ page.url }} |
When I run jekyll build
Then I should get a zero exit status
And the _site/2017/07/06 directory should exist
And the "_site/2017/07/06/unrendered-post.html" file should exist
And the "_site/2017/07/06/rendered-post.html" file should exist
And I should see "Liquid is not rendered at {{ page.url }}" in "_site/2017/07/06/unrendered-post.html"
But I should see "<p>Liquid is rendered at /2017/07/06/rendered-post.html</p>" in "_site/2017/07/06/rendered-post.html"
And I should see "<p>Liquid is not rendered at {{ page.url }}</p>\n<p>Liquid is rendered at /2017/07/06/rendered-post.html</p>" in "_site/index.html"

View File

@ -89,6 +89,7 @@ module Jekyll
end
def render_with_liquid?
return false if data["render_with_liquid"] == false
!(coffeescript_file? || yaml_file? || !Utils.has_liquid_construct?(content))
end