From 4ee866c3a8cd12d0eb6b56faf460cfe01d5368f7 Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Tue, 31 Jul 2018 16:21:14 +0200 Subject: [PATCH] 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]