Skip to content

Render layouts with full site.archives #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/jekyll-archives.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@ def generate(site)
@site.config['jekyll-archives'] = @config

read
render
write

@site.keep_files ||= []
@archives.each do |archive|
@site.keep_files << archive.relative_path
end
@site.config["archives"] = @archives

render
write
end

# Read archive data from posts
Expand Down
4 changes: 4 additions & 0 deletions test/source/_layouts/archive-site-archives.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
layout: null
---
{{ site.archives.size }}
18 changes: 18 additions & 0 deletions test/test_jekyll_archives.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,24 @@ class TestJekyllArchives < Minitest::Test
end
end

context "the jekyll-archives plugin with layout using {{ site.archives }}" do
setup do
@site = fixture_site({
"jekyll-archives" => {
"enabled" => true,
"layout" => "archive-site-archives"
}
})
@site.process
end

should "populate the {{ site.archives }} tag in archives layout" do
assert_equal 12, read_file("/2014/index.html").to_i
assert_equal 12, read_file("/2013/index.html").to_i
assert_equal 12, read_file("/tag/test-tag/index.html").to_i
end
end

context "the jekyll-archives plugin with type-specific layout" do
setup do
@site = fixture_site({
Expand Down