Aquire title and date from the metadata block of every post instead

This commit is contained in:
Lux49 2020-07-11 00:28:31 +02:00
parent 043338995f
commit 4aae6cd240

View File

@ -1,6 +1,6 @@
#!/bin/sh
blog_domain='https://blog.kageru.moe/'
blog_domain='https://lucy.moe/'
output() {
echo "$1" >> index.html
@ -11,17 +11,17 @@ output_rss() {
}
add_header() {
output '<h1>Blog index</h1><table id="linklist">'
output '<h1>posts</h1><table id="linklist">'
output_rss '<?xml version="1.0" encoding="UTF-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
<author><name>kageru</name></author>
<title>kageru’s blog</title>'
output_rss " <link href=\"$blog_domain\" rel=\"self\" type=\"application/atom+xml\"/>
<description>kageru’s blog</description>"
<description>Lucys blog</description>"
}
add_footer() {
html_entry "legacy" "before 2020" "Older posts"
html_entry "https://asagi.moe" "before 07-2020" "Old site"
output '</table>'
output_rss '</feed>'
}
@ -56,8 +56,8 @@ create_entry() {
# convert new markdown posts to html
pandoc "$path" -t html -f markdown -o "$outpath"
# then add it to the index
title="$(rg 'h1' "$outpath" | head -n1 | rg -o '(?<=>).*(?=<)' --pcre2)"
created=$(git log --follow --format=%as "$path" | tail -1)
title="$(grep -h '^title: ' "$path" | sed 's/title: //g')"
created=$(grep -h '^date: ' "$path" | sed 's/date: //g')
html_entry "$outpath" "created on $created" "$title"
rss_entry "$title" "$outpath"
}