From dd4efd4f8e41dafcc522fd09a78e27baeb9bd2ab Mon Sep 17 00:00:00 2001 From: lsof Date: Sun, 15 Sep 2024 12:30:02 +0200 Subject: blog: add taxonomies (tags) --- config.toml | 4 ++++ content/w/c99-vla-tricks.md | 2 ++ content/w/first.md | 2 ++ templates/blog-page.html | 7 ++++++- templates/blog.html | 3 ++- templates/taxonomy_list.html | 17 +++++++++++++++++ templates/taxonomy_single.html | 17 +++++++++++++++++ 7 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 templates/taxonomy_list.html create mode 100644 templates/taxonomy_single.html diff --git a/config.toml b/config.toml index 4b1b1bb..3d43084 100644 --- a/config.toml +++ b/config.toml @@ -10,6 +10,10 @@ build_search_index = false # When set to "true", the generated HTML files are minified. minify_html = false +taxonomies = [ + { name = "tags", feed = true}, +] + [markdown] # Whether to do syntax highlighting # Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola diff --git a/content/w/c99-vla-tricks.md b/content/w/c99-vla-tricks.md index b2b07eb..539ddd8 100644 --- a/content/w/c99-vla-tricks.md +++ b/content/w/c99-vla-tricks.md @@ -1,6 +1,8 @@ --- title: "C99 doesn't need function bodies, or 'VLAs are Turing complete'" date: 2022-02-19 +taxonomies: + tags: ["programming", "c"] --- Preface diff --git a/content/w/first.md b/content/w/first.md index 291b364..378ab1a 100644 --- a/content/w/first.md +++ b/content/w/first.md @@ -1,6 +1,8 @@ +++ title = "test post" date = 2022-02-02 +[taxonomies] +tags = [] +++ # test diff --git a/templates/blog-page.html b/templates/blog-page.html index ddf34f0..51f8aba 100644 --- a/templates/blog-page.html +++ b/templates/blog-page.html @@ -5,12 +5,17 @@ {% block content %}

{{ page.title }}

{{ page.date | date(format="%-d %b %Y") }}

+

+ {% for tag in page.taxonomies.tags %} + #{{ tag }} + {% endfor %} +


{{ page.content | safe }} diff --git a/templates/blog.html b/templates/blog.html index fb7ea21..f8f422f 100644 --- a/templates/blog.html +++ b/templates/blog.html @@ -4,11 +4,12 @@ {% block content %}

{{ section.title }}

+Browse by tags