diff options
author | eug-vs <eugene@eug-vs.xyz> | 2022-04-21 19:31:12 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2022-04-21 19:31:12 +0300 |
commit | b9f6105139f223672cbdc56efccfa06d55c314a4 (patch) | |
tree | b2b0f6ebe27094d3d6422721e4ba9d03f1571d19 | |
parent | 978a7dad46a07c4d00ae9fe5d291cd55b17dc12d (diff) | |
download | benzin-b9f6105139f223672cbdc56efccfa06d55c314a4.tar.gz |
feat: add publication date to RSS
-rw-r--r-- | Makefile | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -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) |