From 3656492fab859bf7f0d2d6af2c594df32ae306ac Mon Sep 17 00:00:00 2001 From: Kostas Antonopoulos Date: Tue, 1 Nov 2022 17:59:19 +0200 Subject: [PATCH 1/2] Allow to get archive category title from a data file for SEO. --- lib/jekyll-archives/archive.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/jekyll-archives/archive.rb b/lib/jekyll-archives/archive.rb index 948bcff..3ad5d01 100644 --- a/lib/jekyll-archives/archive.rb +++ b/lib/jekyll-archives/archive.rb @@ -41,6 +41,18 @@ 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 + end + end + end # The template of the permalink. From 90a22f12c36ac2fbc6b006a80507f8716f6f99b8 Mon Sep 17 00:00:00 2001 From: Kostas Antonopoulos Date: Wed, 9 Nov 2022 18:21:55 +0200 Subject: [PATCH 2/2] [ADD] show_date and show_author page properties, confugurable through blog_categories file --- lib/jekyll-archives/archive.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/jekyll-archives/archive.rb b/lib/jekyll-archives/archive.rb index 3ad5d01..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) @@ -50,6 +54,10 @@ def initialize(site, title, type, posts) 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