From d42399ae92a56146cca72d3421816ae730c26357 Mon Sep 17 00:00:00 2001
From: Sylvain Gauthier
Date: Sun, 14 Mar 2021 12:51:30 +1100
Subject: [PATCH] add list of tag links at the end of each recipe
---
Makefile | 9 ++++++++-
templates/tag_link.html | 1 +
templates/tag_link_footer.html | 1 +
templates/tag_link_header.html | 1 +
4 files changed, 11 insertions(+), 1 deletion(-)
create mode 100644 templates/tag_link.html
create mode 100644 templates/tag_link_footer.html
create mode 100644 templates/tag_link_header.html
diff --git a/Makefile b/Makefile
index be6e800..5021f9a 100644
--- a/Makefile
+++ b/Makefile
@@ -131,7 +131,7 @@ blog/@%.html: $(TAGFILES) $(addprefix templates/,$(addsuffix .html,header tag_in
envsubst < templates/footer.html >> $@; \
-blog/%.html: $(BLOG_SRC)/%.md $(addprefix templates/,$(addsuffix .html,header article_header article_footer footer))
+blog/%.html: $(BLOG_SRC)/%.md $(addprefix templates/,$(addsuffix .html,header article_header tag_link_header tag_link tag_link_footer article_footer footer))
mkdir -p blog
TITLE="$(shell head -n1 $< | sed 's/^# \+//')"; \
export TITLE; \
@@ -148,6 +148,13 @@ blog/%.html: $(BLOG_SRC)/%.md $(addprefix templates/,$(addsuffix .html,header ar
envsubst < templates/header.html > $@; \
envsubst < templates/article_header.html >> $@; \
sed -e '/^;/d' < $< | markdown -f fencedcode >> $@; \
+ envsubst < templates/tag_link_header.html >> $@; \
+ for i in $${TAGS} ; do \
+ TAG_NAME="$$i" \
+ TAG_LINK="./@$$i.html" \
+ envsubst < templates/tag_link.html >> $@; \
+ done; \
+ envsubst < templates/tag_link_footer.html >> $@; \
envsubst < templates/article_footer.html >> $@; \
envsubst < templates/footer.html >> $@; \
diff --git a/templates/tag_link.html b/templates/tag_link.html
new file mode 100644
index 0000000..49cc68c
--- /dev/null
+++ b/templates/tag_link.html
@@ -0,0 +1 @@
+$TAG_NAME
diff --git a/templates/tag_link_footer.html b/templates/tag_link_footer.html
new file mode 100644
index 0000000..38bf9e7
--- /dev/null
+++ b/templates/tag_link_footer.html
@@ -0,0 +1 @@
+
diff --git a/templates/tag_link_header.html b/templates/tag_link_header.html
new file mode 100644
index 0000000..c566585
--- /dev/null
+++ b/templates/tag_link_header.html
@@ -0,0 +1 @@
+ Recipe tags: