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 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..22a47b4 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] @@ -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/"