diff --git a/lib/jekyll-archives/archive.rb b/lib/jekyll-archives/archive.rb index 948bcff..f5c3b44 100644 --- a/lib/jekyll-archives/archive.rb +++ b/lib/jekyll-archives/archive.rb @@ -3,7 +3,7 @@ module Jekyll module Archives class Archive < Jekyll::Page - attr_accessor :posts, :type, :slug + attr_accessor :posts, :type, :slug, :show_date, :show_author # Attributes for Liquid templates ATTRIBUTES_FOR_LIQUID = %w( @@ -15,6 +15,8 @@ class Archive < Jekyll::Page path url permalink + show_date + show_author ).freeze # Initialize a new Archive page @@ -31,6 +33,8 @@ def initialize(site, title, type, posts) @title = title @config = site.config["jekyll-archives"] @slug = slugify_string_title + @show_author = true + @show_date = true # Use ".html" for file extension and url for path @ext = File.extname(relative_path) @@ -41,6 +45,22 @@ def initialize(site, title, type, posts) "layout" => layout, } @content = "" + + if type == "category" + if @config["categories_data_file"] && @site.data[@config["categories_data_file"]] && @site.data[@config["categories_data_file"]][title] + @categoryData = @site.data[@config["categories_data_file"]][title] + if !@categoryData["archive_title"].nil? + @title = @categoryData["archive_title"] + elsif !@categoryData["name"].nil? + @title = @categoryData["name"] + end + + @show_author = @categoryData["show_author"] unless @categoryData["show_author"].nil? + @show_date = @categoryData["show_date"] unless @categoryData["show_date"].nil? + + end + end + end # The template of the permalink.