diff options
author | eug-vs <eugene@eug-vs.xyz> | 2021-08-13 23:14:38 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2021-08-13 23:14:38 +0300 |
commit | 4fa5a63695f30813723530b9cf63d197a1696c7a (patch) | |
tree | 914ce0a4ead902e6166a5689176ad435568d72b5 | |
parent | a6eb667c6b54bb3f084b5dd65711e81e975ce6c4 (diff) | |
download | eug-vs-xyz-4fa5a63695f30813723530b9cf63d197a1696c7a.tar.gz |
feat: dynamically set page title
-rw-r--r-- | Makefile | 14 | ||||
-rwxr-xr-x | head.html (renamed from icon.html) | 0 |
2 files changed, 9 insertions, 5 deletions
@@ -3,10 +3,10 @@ BROWSER=brave MARKDOWN=gfm+emoji STYLESHEET=/style.css +HEAD=head.html HEADER=header.html -ICON=icon.html -PAGETITLE="Eugene's Space" -PANDOC_ARGS=-s --from=$(MARKDOWN) --to=html -c $(STYLESHEET) -B $(HEADER) -H $(ICON) -M pagetitle=$(PAGETITLE) --shift-heading-level-by=1 --highlight-style=gruvbox.theme +TITLE=Eugene's Space +PANDOC_ARGS=-s --from=$(MARKDOWN) --to=html -c $(STYLESHEET) -B $(HEADER) -H $(HEAD) --shift-heading-level-by=1 --highlight-style=gruvbox.theme LINK_SEDSTRING=s/.md)/.html)/g; EMOJI_SEDSTRING=$(shell ./compile_emoji_sedstring.sh) @@ -22,11 +22,15 @@ all: $(HTML) %.html: %.md @echo $@ - @sed "$(LINK_SEDSTRING) $(EMOJI_SEDSTRING)" $< | pandoc $(PANDOC_ARGS) > $@ + @PAGETITLE=$$(sed '/^#/q' $< | sed 's/:[a-z]*://; s/#* //'); \ + sed "$(LINK_SEDSTRING) $(EMOJI_SEDSTRING)" $< \ + | pandoc $(PANDOC_ARGS) -M pagetitle="$$PAGETITLE | $(TITLE)" > $@ index.html: index.md blog/preview.md @echo $@ - @sed "/Recent blog posts/r blog/preview.md" $< | sed "$(LINK_SEDSTRING) $(EMOJI_SEDSTRING)" | pandoc $(PANDOC_ARGS) > $@ + @sed "/Recent blog posts/r blog/preview.md" $< \ + | sed "$(LINK_SEDSTRING) $(EMOJI_SEDSTRING)" \ + | pandoc $(PANDOC_ARGS) -M pagetitle="$(TITLE)" > $@ blog/preview.md: blog/index.md @echo $@ |