added rss generation, probably very buggy

This commit is contained in:
/dev/urandom 2020-06-15 10:54:35 +03:00
parent 4b2ad15fbd
commit 4cbc329baa
6 changed files with 48 additions and 2 deletions

View file

@ -27,7 +27,7 @@ OUT_STATIC = $(patsubst static/%,out/%,$(_STATIC_FILES)) $(patsubst static/%.h,o
.SUFFIXES:
.PHONY: all upload
all: $(OUTDIR)/blog/index.html $(PAGES_HTML) $(OUT_STATIC)
all: $(OUTDIR)/blog/index.html $(OUTDIR)/blog/main.rss $(PAGES_HTML) $(OUT_STATIC)
upload:
./upload.sh
@ -36,6 +36,10 @@ $(OUTDIR)/blog/index.html: $(_BLOG_PAGES) $(TPLDIR)/blog_header.md $(TPLDIR)/blo
@mkdir -p $(@D)
./blogindex.sh | $(THEME) -C style -t $(TPLDIR)/default.tpl -p blog/index.html -o $@
$(OUTDIR)/blog/main.rss: $(_BLOG_PAGES)
@mkdir -p $(@D)
./blogrss.sh > $@
$(OUTDIR)/%.html: $(PAGEDIR)/%.md $(TPLDIR)/default.tpl
@mkdir -p $(@D)
$(THEME) -C style -t $(TPLDIR)/default.tpl -p $(patsubst $(OUTDIR)/%,%,$@) -o $@ $<

View file

@ -7,7 +7,7 @@ if [[ -z $LASTUPLOAD ]]; then LASTUPLOAD=0; fi
#echo "Last upload at $LASTUPLOAD"
FILES=`ls $DIRECTORY/*.md -1ct`
FILES=`ls $DIRECTORY/*.md -1t`
cat tpl/blog_header.md

38
blogrss.sh Executable file
View file

@ -0,0 +1,38 @@
#!/bin/bash
DIRECTORY="pages/blog"
FILES=`ls $DIRECTORY/*.md -1t`
cat << RSSHEADER
<?xml version="1.0" encoding=\"UTF-8\" ?>
<rss version="2.0">
<channel>
<title>rnd's blog</title>
<link>https://rnd.neocities.org/blog</link>
<description>The RSS feed of articles published on the blog thingy</description>
RSSHEADER
for f in $FILES; do
MTIME=`stat -c %Y $f`
TITLE=`head -n 1 $f`
TITLE=${TITLE#"% "}
OUTPAGE=${f%.md}.html
OUTPAGE=/${OUTPAGE#pages/}
LASTUPD=`date -R -u -d "@$MTIME"`
cat <<- RSSITEM
<item>
<title>$TITLE</title>
<link>$OUTPAGE</link>
<pubdate>$LASTUPD</pubdate>
</item>
RSSITEM
done
cat << RSSFOOTER
</channel>
RSSFOOTER

View file

@ -143,6 +143,7 @@ and links for people who want to learn or use toki pona:
* ["ma pona pi toki pona" Discord server](https://discord.gg/XKzj3ex)
* [toki pona Telegram group](https://telegram.me/joinchat/BLVsYz92zHUp2h2TYp9kTA)
* * [IRC channel #tokipona on Freenode, bridged with the Telegram group](ircs://freenode.org:6697/#tokipona)
* ["kulupu pi toki pona" Telegram group](https://t.me/kulupupitokipona) (this
one is usually more about talking _in_ toki pona)

View file

@ -0,0 +1,2 @@
<a href="https://rnd.neocities.org/blog/main.rss" rel="alternate" title="RSS feed" type="application/rss+xml"><img src="/rss.gif" alt="RSS logo" style="vertical-align: middle; padding: 4px;" />Subscribe to RSS feed</a>

View file

@ -2,6 +2,7 @@
% /dev/urandom
% may 2020
This is a small sort of blog where I (very rarely) post stuff. Mostly small bits
of information that i'd like to remember in the future or make public.