blog

git clone https://git.ce9e.org/blog.git

commit
6d665c6f28f7a1db6deaeb715a0e2e87e87ead83
parent
ecd6e0133b6a87c32fb275f3b46788e86e9e1c8d
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2023-12-16 17:08
feed: move all but last 10 entries to archive

Diffstat

M Makefile 5 ++++-
M feed.sh 11 +++++++++--

2 files changed, 13 insertions, 3 deletions


diff --git a/Makefile b/Makefile

@@ -7,7 +7,7 @@ IMG := $(shell find _content -regex '.*\.\(png\|gif\|jpg\)$$' | sed 's/^_content
    7     7 PANDOC_ARGS = -f markdown-smart --wrap=none
    8     8 
    9     9 .PHONY: all
   10    -1 all: build/index.html $(PAGES) $(PAGES_MD) build/feed.xml $(STATIC) build/static/style.css $(IMG)
   -1    10 all: build/index.html $(PAGES) $(PAGES_MD) build/feed.xml build/feed-archive.xml $(STATIC) build/static/style.css $(IMG)
   11    11 
   12    12 .PHONY: push
   13    13 push: all
@@ -41,6 +41,9 @@ build/%.gif: _content/%.gif
   41    41 build/feed.xml: feed.sh $(PAGES_FEED)
   42    42 	./feed.sh > $@
   43    43 
   -1    44 build/feed-archive.xml: feed.sh $(PAGES_FEED)
   -1    45 	./feed.sh -a > $@
   -1    46 
   44    47 build/static/%: static/%
   45    48 	@mkdir -p $$(dirname $@)
   46    49 	ln $< $@

diff --git a/feed.sh b/feed.sh

@@ -11,9 +11,16 @@ echo '<feed xmlns="http://www.w3.org/2005/Atom">'
   11    11 echo '	<author><name>Tobias Bengfort</name></author>'
   12    12 echo '	<title>Ξ</title>'
   13    13 echo "	<id>$base_url</id>"
   14    -1 echo '	<link href="https://blog.ce9e.org/" rel="self" />'
   -1    14 echo "	<link href=\"$base_url\" rel=\"self\" />"
   -1    15 if [ "$1" = '-a' ]; then
   -1    16 	echo "	<link href=\"${base_url}feed.xml\" rel=\"current\" />"
   -1    17 	select='tail -n +11'
   -1    18 else
   -1    19 	echo "	<link href=\"${base_url}feed-archive.xml\" rel=\"prev-archive\" />"
   -1    20 	select='head -n 10'
   -1    21 fi
   15    22 
   16    -1 ls _content/posts | tac | while read l; do
   -1    23 ls _content/posts | tac | $select | while read l; do
   17    24 	yml="_content/posts/$l/index.md"
   18    25 	html="_content/posts/$l/index.html"
   19    26 	url="${base_url}posts/$l/"