Respect collections_dir config within include tag (#8756)
Merge pull request 8756
This commit is contained in:
parent
55b6972ea7
commit
aa9a4164d0
|
@ -67,6 +67,25 @@ Feature: Incremental rebuild
|
||||||
And the _site directory should exist
|
And the _site directory should exist
|
||||||
And I should see "Basic Site with include tag: Regenerated by Jekyll" in "_site/index.html"
|
And I should see "Basic Site with include tag: Regenerated by Jekyll" in "_site/index.html"
|
||||||
|
|
||||||
|
Scenario: Rebuild when a dependency of document in custom collection_dir is changed
|
||||||
|
Given I have a _includes directory
|
||||||
|
And I have a configuration file with "collections_dir" set to "collections"
|
||||||
|
And I have a collections/_posts directory
|
||||||
|
And I have the following post within the "collections" directory:
|
||||||
|
| title | date | layout | content |
|
||||||
|
| Wargames | 2009-03-27 | default | Basic Site with include tag: {% include about.html %} |
|
||||||
|
And I have an "_includes/about.html" file that contains "Generated by Jekyll"
|
||||||
|
When I run jekyll build -I
|
||||||
|
Then I should get a zero exit status
|
||||||
|
And the _site directory should exist
|
||||||
|
And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/2009/03/27/wargames.html"
|
||||||
|
When I wait 1 second
|
||||||
|
Then I have an "_includes/about.html" file that contains "Regenerated by Jekyll"
|
||||||
|
When I run jekyll build -I
|
||||||
|
Then I should get a zero exit status
|
||||||
|
And the _site directory should exist
|
||||||
|
And I should see "Basic Site with include tag: Regenerated by Jekyll" in "_site/2009/03/27/wargames.html"
|
||||||
|
|
||||||
Scenario: A themed-site and incremental regeneration
|
Scenario: A themed-site and incremental regeneration
|
||||||
Given I have a configuration file with "theme" set to "test-theme"
|
Given I have a configuration file with "theme" set to "test-theme"
|
||||||
And I have an "index.md" page that contains "Themed site"
|
And I have an "index.md" page that contains "Themed site"
|
||||||
|
|
|
@ -234,12 +234,18 @@ module Jekyll
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_include_to_dependency(inclusion, context)
|
def add_include_to_dependency(inclusion, context)
|
||||||
return unless context.registers[:page]&.key?("path")
|
page = context.registers[:page]
|
||||||
|
return unless page&.key?("path")
|
||||||
|
|
||||||
@site.regenerator.add_dependency(
|
page_path = context.registers[:page]["path"]
|
||||||
@site.in_source_dir(context.registers[:page]["path"]),
|
absolute_path = \
|
||||||
inclusion.path
|
if page["collection"]
|
||||||
)
|
@site.in_source_dir(@site.config["collections_dir"], page_path)
|
||||||
|
else
|
||||||
|
@site.in_source_dir(page_path)
|
||||||
|
end
|
||||||
|
|
||||||
|
@site.regenerator.add_dependency(absolute_path, inclusion.path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue