diff options
author | eug-vs <eugene@eug-vs.xyz> | 2022-04-21 19:15:10 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2022-04-21 19:20:14 +0300 |
commit | 978a7dad46a07c4d00ae9fe5d291cd55b17dc12d (patch) | |
tree | 574b051f5aeb4c60c43b71b1375ec81af1140940 | |
parent | 06a24a58e0569d5c1cd6af27a9ac875713f023fb (diff) | |
download | benzin-978a7dad46a07c4d00ae9fe5d291cd55b17dc12d.tar.gz |
feat: add blog preview feature
-rw-r--r-- | Makefile | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -12,6 +12,8 @@ RSS_ITEM_TEMPLATE=templates/rss_item.xml EMOJI_SIZE=20 EMOJI_STYLE=margin-bottom: -4px; +BLOG_PREVIEW_MARKER=Recent blog posts + RSS=out/blog/index.xml OPENRING_FOOTER=tmp/openring.html @@ -47,14 +49,28 @@ tmp/%.content.html: src/%.md tmp/emoji.sed @mkdir -p $(@D) sed -e "s/.md)/.html)/g" -f tmp/emoji.sed $< | $(CONVERT) > $@ +out/index.html: tmp/index.content.html $(PAGE_TEMPLATE) + @mkdir -p $(@D) + sed "/<\/main>/e cat $<" $(PAGE_TEMPLATE) > $@ + sed -i \ + -e '/<head>/{' \ + -e 'a <title>$(WEBSITE_TITLE)<\/title>' \ + -e '}' $@ + +tmp/index.content.html: src/index.md tmp/emoji.sed tmp/blog/preview.md + @mkdir -p $(@D) + sed -e "/$(BLOG_PREVIEW_MARKER)/r tmp/blog/preview.md" $< \ + | sed -e "s/.md)/.html)/g" -f tmp/emoji.sed \ + | $(CONVERT) > $@ + tmp/%.meta.title: src/%.md @mkdir -p $(@D) sed '/^#/q' $< | sed 's/#* //' > $@ @echo "| $(WEBSITE_TITLE)" >> $@ -tmp/index.meta.title: +tmp/blog/preview.md: src/blog/index.md @mkdir -p $(@D) - echo $(WEBSITE_TITLE) > $@ + sed -n "s/^-/ -/; s|(|(blog/| ; /^ -/p" $< | head -n 4 > $@ $(RSS): $(BLOG_XML) $(RSS_TEMPLATE) @mkdir -p $(@D) |