From 4ee866c3a8cd12d0eb6b56faf460cfe01d5368f7 Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Tue, 31 Jul 2018 16:21:14 +0200 Subject: [PATCH 1/3] Update theme to gutenberg 0.4 --- config.toml | 6 ++++-- content/some-article.md | 4 +++- content/some-other-article.md | 2 ++ .../{categories.html => categories/list.html} | 6 +++--- .../{category.html => categories/single.html} | 4 ++-- templates/page.html | 17 +++++++++-------- templates/{tags.html => tags/list.html} | 6 +++--- templates/{tag.html => tags/single.html} | 4 ++-- theme.toml | 2 +- 9 files changed, 29 insertions(+), 22 deletions(-) rename templates/{categories.html => categories/list.html} (60%) rename templates/{category.html => categories/single.html} (78%) rename templates/{tags.html => tags/list.html} (59%) rename templates/{tag.html => tags/single.html} (77%) diff --git a/config.toml b/config.toml index 7c6d1b5..b5aa9b7 100644 --- a/config.toml +++ b/config.toml @@ -3,8 +3,10 @@ compile_sass = true title = "after-dark theme" description = "" -generate_tags_pages = true -generate_categories_pages = true +taxonomies = [ + {name = "categories", rss = true}, + {name = "tags", rss = true}, +] [extra] author = "Vincent" diff --git a/content/some-article.md b/content/some-article.md index 1ed54c3..0630404 100644 --- a/content/some-article.md +++ b/content/some-article.md @@ -1,7 +1,9 @@ +++ title = "What is Gutenberg" date = 2017-09-24 -category = "Hello world" + +[taxonomies] +categories = ["Hello world"] +++ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc eu feugiat sapien. Aenean ligula nunc, laoreet id sem in, interdum bibendum felis. Donec vel dui neque. Praesent ac sem ut justo volutpat rutrum a imperdiet tellus. Nam lobortis massa non hendrerit hendrerit. Vivamus porttitor dignissim turpis, eget aliquam urna tincidunt non. Aliquam et fringilla turpis. Nullam eros est, eleifend in ornare sed, hendrerit eget est. Aliquam tellus felis, suscipit vitae ex vel, fringilla tempus massa. Nulla facilisi. Pellentesque lobortis consequat lectus. Maecenas ac libero elit. diff --git a/content/some-other-article.md b/content/some-other-article.md index 1101b74..7702021 100644 --- a/content/some-other-article.md +++ b/content/some-other-article.md @@ -2,6 +2,8 @@ title = "A first theme for Gutenberg" date = 2017-09-25 category = "Prog" + +[taxonomies] tags = ["rust", "ssg", "other"] +++ diff --git a/templates/categories.html b/templates/categories/list.html similarity index 60% rename from templates/categories.html rename to templates/categories/list.html index 720aad4..dcf20b6 100644 --- a/templates/categories.html +++ b/templates/categories/list.html @@ -7,11 +7,11 @@

Categories

- {% if categories %} + {% if terms %} diff --git a/templates/category.html b/templates/categories/single.html similarity index 78% rename from templates/category.html rename to templates/categories/single.html index 208e662..b7f9055 100644 --- a/templates/category.html +++ b/templates/categories/single.html @@ -6,9 +6,9 @@ {{ super() }} {% endblock header %} -

{{ category.name }}

+

{{ term.name }}

- {% for page in category.pages %} + {% for page in term.pages %} {{ post_macros::page_in_list(page=page) }} {% endfor %} {% endblock content %} diff --git a/templates/page.html b/templates/page.html index 3f42dc1..69df9c8 100644 --- a/templates/page.html +++ b/templates/page.html @@ -19,16 +19,17 @@ {% if config.extra.author %} Published by {{ config.extra.author }} {% endif %} - {% if page.category %} - in {{ page.category }} + {% if page.taxonomies.categories %} + {% set category = page.taxonomies.categories[0] %} + in {{ category }} {% endif %} - {% if page.tags %} + {% if page.taxonomies.tags %} and tagged - {% for tag in page.tags %} - {{ tag }} - {% if page.tags | length > 1 %} - {% if loop.index != page.tags | length %} - {% if loop.index == page.tags | length - 1 %} + {% for tag in page.taxonomies.tags %} + {{ tag }} + {% if page.taxonomies.tags | length > 1 %} + {% if loop.index != page.taxonomies.tags | length %} + {% if loop.index == page.taxonomies.tags | length - 1 %} and {% else %} , diff --git a/templates/tags.html b/templates/tags/list.html similarity index 59% rename from templates/tags.html rename to templates/tags/list.html index 395a3b7..f5f9ee5 100644 --- a/templates/tags.html +++ b/templates/tags/list.html @@ -7,10 +7,10 @@

Tags

- {% if tags %} + {% if terms %} {% endif %} diff --git a/templates/tag.html b/templates/tags/single.html similarity index 77% rename from templates/tag.html rename to templates/tags/single.html index 4cb4c96..a611e56 100644 --- a/templates/tag.html +++ b/templates/tags/single.html @@ -5,9 +5,9 @@ {{ super() }} {% endblock header %} -

{{ tag.name }}

+

{{ term.name }}

- {% for page in tag.pages %} + {% for page in term.pages %} {{ post_macros::page_in_list(page=page) }} {% endfor %} {% endblock content %} diff --git a/theme.toml b/theme.toml index 883e507..a820a93 100644 --- a/theme.toml +++ b/theme.toml @@ -2,7 +2,7 @@ name = "after-dark" description = "A robust, elegant dark theme" license = "MIT" homepage = "https://github.com/Keats/after-dark" -min_version = "0.2" +min_version = "0.4.0" [extra] From f55136fbe137ce78e0aa111e9557d6f74a61d216 Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Tue, 31 Jul 2018 16:22:58 +0200 Subject: [PATCH 2/3] Update original url. Fix #4 --- theme.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/theme.toml b/theme.toml index a820a93..22a47b4 100644 --- a/theme.toml +++ b/theme.toml @@ -13,5 +13,5 @@ homepage = "https://vincent.is" [original] author = "comfusion" -homepage = "https://comfusion.github.io/after-dark/" -repo = "https://github.com/comfusion/after-dark" +homepage = "https://git.habd.as/comfusion/after-dark/" +repo = "https://git.habd.as/comfusion/after-dark/" From c37286103ba1cc823588bff496fef2d02d7bc14e Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Tue, 31 Jul 2018 16:33:12 +0200 Subject: [PATCH 3/3] Update readme to mention taxonomies --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index e12e10b..14726d9 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,19 @@ paginate_by = 5 The posts should therefore be in directly under the `content` folder. +The theme requires tags and categories taxonomies to be enabled in your `config.toml`: + +```toml +taxonomies = [ + # You can enable/disable RSS + {name = "categories", rss = true}, + {name = "tags", rss = true}, +] +``` +If you want to paginate taxonomies pages, you will need to overwrite the templates +as it only works for non-paginated taxonomies by default. + + ## Options ### Top-menu