summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2022-04-21 19:31:12 +0300
committereug-vs <eugene@eug-vs.xyz>2022-04-21 19:31:12 +0300
commitb9f6105139f223672cbdc56efccfa06d55c314a4 (patch)
treeb2b0f6ebe27094d3d6422721e4ba9d03f1571d19
parent978a7dad46a07c4d00ae9fe5d291cd55b17dc12d (diff)
downloadbenzin-b9f6105139f223672cbdc56efccfa06d55c314a4.tar.gz
feat: add publication date to RSS
-rw-r--r--Makefile11
1 files changed, 8 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 77cfb42..22faeb9 100644
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,7 @@ SOURCES=$(wildcard src/*.md) $(BLOG_SOURCES)
TMP_HTML=$(patsubst src/%.md, tmp/%.content.html, $(SOURCES))
HTML=$(patsubst src/%.md, out/%.html, $(SOURCES))
-BLOG_XML=$(patsubst src/%.md, tmp/%.xml, $(BLOG_SOURCES))
+BLOG_XML=$(patsubst src/%.md, tmp/%.xml, $(filter-out src/blog/index.md, $(BLOG_SOURCES)))
PUBLIC_SOURCES=$(shell find src/public -type f)
PUBLIC=$(patsubst src/%, out/%, $(PUBLIC_SOURCES))
@@ -68,6 +68,10 @@ tmp/%.meta.title: src/%.md
sed '/^#/q' $< | sed 's/#* //' > $@
@echo "| $(WEBSITE_TITLE)" >> $@
+tmp/blog/%.meta.date: src/blog/%.md
+ @mkdir -p $(@D)
+ @date --rfc-email -d $* > $@
+
tmp/blog/preview.md: src/blog/index.md
@mkdir -p $(@D)
sed -n "s/^-/ -/; s|(|(blog/| ; /^ -/p" $< | head -n 4 > $@
@@ -82,12 +86,13 @@ $(RSS): $(BLOG_XML) $(RSS_TEMPLATE)
-e "a <lastPubDate>$$(date --rfc-email)<\/lastPubDate>" \
-e '}' $@
-tmp/%.xml: tmp/%.content.html tmp/%.meta.title $(RSS_ITEM_TEMPLATE)
+tmp/%.xml: tmp/%.content.html tmp/%.meta.title tmp/%.meta.date $(RSS_ITEM_TEMPLATE)
@mkdir -p $(@D)
sed "/CDATA/r $<" $(RSS_ITEM_TEMPLATE) > $@
sed -i \
-e '/<item>/{' \
-e 'a <title>' -e "r tmp/$*.meta.title" -e 'a <\/title>' \
+ -e 'a <pubDate>' -e "r tmp/$*.meta.date" -e 'a <\/pubDate>' \
-e "a <link>$(WEBSITE_URL)/$*.html<\/link>" \
-e '}' $@
@@ -97,7 +102,7 @@ $(OPENRING_FOOTER): $(OPENRING_TEMPLATE)
out/public/%: src/public/%
@mkdir -p $(@D)
- cp $^ $@
+ @cp $^ $@
out/public/emoji/%.png: src/public/emoji/%.png
@mkdir -p $(@D)