summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlsof <lsof@mailbox.org>2024-09-15 12:30:02 +0200
committerlsof <lsof@mailbox.org>2024-09-15 12:30:02 +0200
commitdd4efd4f8e41dafcc522fd09a78e27baeb9bd2ab (patch)
treea054c4e588cc705a9fce55eff7173398eeb67fb4
parentbe3c967c2dac40a0ea573a443ef858d8cd4aa8ba (diff)
blog: add taxonomies (tags)
-rw-r--r--config.toml4
-rw-r--r--content/w/c99-vla-tricks.md2
-rw-r--r--content/w/first.md2
-rw-r--r--templates/blog-page.html7
-rw-r--r--templates/blog.html3
-rw-r--r--templates/taxonomy_list.html17
-rw-r--r--templates/taxonomy_single.html17
7 files changed, 50 insertions, 2 deletions
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 %}
<nav class="navbar">
- <a href="/">Home</a> <a href="../">Go Back</a>
+ <a href="/">Home</a>
</nav>
<h1 class="title">
{{ page.title }}
</h1>
<p class="subtitle">{{ page.date | date(format="%-d %b %Y") }}</p>
+<p class="subtitle">
+ {% for tag in page.taxonomies.tags %}
+ <a href="/tags/{{ tag | safe}}">#{{ tag }}</a>
+ {% endfor %}
+</p>
<hr>
{{ 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 %}
<nav class="navbar">
- <a href="/">Home</a> <!--a href="../">Go Back</a--!>
+ <a href="/">Home</a>
</nav>
<h1 class="title">
{{ section.title }}
</h1>
+Browse by <a href="/tags">tags</a>
<ul>
{% for page in section.pages %}
<li><a href="{{ page.permalink | safe }}">{{ page.title }}</a> ({{ page.date }})</li>
diff --git a/templates/taxonomy_list.html b/templates/taxonomy_list.html
new file mode 100644
index 0000000..084e3b5
--- /dev/null
+++ b/templates/taxonomy_list.html
@@ -0,0 +1,17 @@
+{% extends "base.html" %}
+
+{% block title %}Browse by {{taxonomy.name}}{% endblock title %}
+
+{% block content %}
+<nav class="navbar">
+ <a href="/">Home</a> <!--a href="../">Go Back</a--!>
+</nav>
+<h1 class="title">
+ {{ taxonomy.name }}
+</h1>
+<ul>
+ {% for term in terms %}
+ <li><a href="{{ term.permalink | safe }}">#{{ term.name }}</a> </li>
+ {% endfor %}
+</ul>
+{% endblock content %}
diff --git a/templates/taxonomy_single.html b/templates/taxonomy_single.html
new file mode 100644
index 0000000..9f93975
--- /dev/null
+++ b/templates/taxonomy_single.html
@@ -0,0 +1,17 @@
+{% extends "base.html" %}
+
+{% block title %}#{{ term.name }}{% endblock title %}
+
+{% block content %}
+<nav class="navbar">
+ <a href="/">Home</a> <!--a href="../">Go Back</a--!>
+</nav>
+<h1 class="title">
+ #{{ term.name }}
+</h1>
+<ul>
+ {% for page in term.pages %}
+ <li><a href="{{ page.permalink | safe }}">{{ page.title }}</a> ({{ page.date }})</li>
+ {% endfor %}
+</ul>
+{% endblock content %}