summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2022-04-20 14:28:36 +0300
committereug-vs <eugene@eug-vs.xyz>2022-04-20 14:28:36 +0300
commit2bd2947a52df59e573726de1471c4fd76505b392 (patch)
tree26635c1ffb1b63e2c52691314f28a9719e4790c9
parentca04dd60746e9f4ee9f58594577c10776e7d55d2 (diff)
downloadeug-vs-xyz-2bd2947a52df59e573726de1471c4fd76505b392.tar.gz
feat: add openring footer to blog posts
-rw-r--r--Makefile12
-rw-r--r--openring-template.html49
2 files changed, 58 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 10adc51..210c5aa 100644
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,7 @@ MARKDOWN=gfm+emoji
STYLESHEET=/style.css
HEAD=head.html
HEADER=header.html
+OPENRING_FOOTER=footer.html
PANDOC_ARGS=-s --from=$(MARKDOWN) --to=html -c $(STYLESHEET) -B $(HEADER) -H $(HEAD) -M lang="en" --shift-heading-level-by=1 --highlight-style=gruvbox.theme
LINK_SEDSTRING=s/.md)/.html)/g;
@@ -12,6 +13,8 @@ EMOJI_SEDSTRING=$(shell ./compile_emoji_sedstring.sh)
LOCALIZE_SEDSTRING=s|\"/|\"$(PWD)/|;
UNLOCALIZE_SEDSTRING=s|$(PWD)||;
+OPENRING_FEED="https://drewdevault.com/feed.xml"
+
SOURCES=$(wildcard *.md blog/*.md articles/*.md)
HTML=$(patsubst %.md, %.html, $(SOURCES))
@@ -19,12 +22,12 @@ HTML=$(patsubst %.md, %.html, $(SOURCES))
all: $(HTML)
-%.html: %.md
+%.html: %.md $(OPENRING_FOOTER)
@echo $@
@DESCRIPTION=$$(sed '2,/^$$/!d' $< | tr '\n' ' '); \
PAGETITLE=$$(sed '/^#/q' $< | sed 's/:[a-z]*://; s/#* //'); \
sed "$(LINK_SEDSTRING) $(EMOJI_SEDSTRING)" $< \
- | pandoc $(PANDOC_ARGS) -M pagetitle="$$PAGETITLE | $(TITLE)" -M description="$$DESCRIPTION" > $@
+ | pandoc $(PANDOC_ARGS) -M pagetitle="$$PAGETITLE | $(TITLE)" -A $(OPENRING_FOOTER) -M description="$$DESCRIPTION" > $@
index.html: index.md blog/preview.md
@echo $@
@@ -33,6 +36,9 @@ index.html: index.md blog/preview.md
| sed "$(LINK_SEDSTRING) $(EMOJI_SEDSTRING)" \
| pandoc $(PANDOC_ARGS) -M pagetitle="$(TITLE)" -M description="$$DESCRIPTION"> $@
+$(OPENRING_FOOTER): openring-template.html
+ openring -s $(OPENRING_FEED) < $< > $@
+
blog/preview.md: blog/index.md
@echo $@
@sed -n "s/^-/ -/; s|(|(blog/| ; /^ -/p" $< | head -n 4 > $@
@@ -51,5 +57,5 @@ unlocalize: $(HTML)
@for file in $^; do sed -i "$(UNLOCALIZE_SEDSTRING)" $$file; done
clean:
- rm -f $(HTML) blog/preview.md
+ rm -f $(HTML) $(OPENRING_FOOTER) blog/preview.md
diff --git a/openring-template.html b/openring-template.html
new file mode 100644
index 0000000..a9f63e6
--- /dev/null
+++ b/openring-template.html
@@ -0,0 +1,49 @@
+<section class="webring">
+ <h3>Articles from blogs I follow around the net</h3>
+ <section class="articles">
+ {{range .Articles}}
+ <div class="article">
+ <h4 class="title">
+ <a href="{{.Link}}" target="_blank" rel="noopener">{{.Title}}</a>
+ </h4>
+ <p class="summary">{{.Summary}}</p>
+ <small class="source">
+ via <a href="{{.SourceLink}}">{{.SourceTitle}}</a>
+ </small>
+ <small class="date">{{.Date | datef "January 2, 2006"}}</small>
+ </div>
+ {{end}}
+ </section>
+ <p class="attribution">
+ Generated by
+ <a href="https://git.sr.ht/~sircmpwn/openring">openring</a>
+ </p>
+</section>
+<style>
+.webring .articles {
+ display: flex;
+ flex-wrap: wrap;
+ margin: -0.5rem;
+}
+.webring .title {
+ margin: 0;
+}
+.webring .article {
+ flex: 1 1 0;
+ display: flex;
+ flex-direction: column;
+ margin: 0.5rem;
+ padding: 0.5rem;
+ background: #eee;
+ min-width: 10rem;
+}
+.webring .summary {
+ font-size: 0.8rem;
+ flex: 1 1 0;
+}
+.webring .attribution {
+ text-align: right;
+ font-size: 0.8rem;
+ color: #555;
+}
+</style>