forked from kageru/mdb
Aquire title and date from the metadata block of every post instead
This commit is contained in:
parent
043338995f
commit
4aae6cd240
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
blog_domain='https://blog.kageru.moe/'
|
blog_domain='https://lucy.moe/'
|
||||||
|
|
||||||
output() {
|
output() {
|
||||||
echo "$1" >> index.html
|
echo "$1" >> index.html
|
||||||
|
@ -11,17 +11,17 @@ output_rss() {
|
||||||
}
|
}
|
||||||
|
|
||||||
add_header() {
|
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" ?>
|
output_rss '<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
|
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
|
||||||
<author><name>kageru</name></author>
|
<author><name>kageru</name></author>
|
||||||
<title>kageru’s blog</title>'
|
<title>kageru’s blog</title>'
|
||||||
output_rss " <link href=\"$blog_domain\" rel=\"self\" type=\"application/atom+xml\"/>
|
output_rss " <link href=\"$blog_domain\" rel=\"self\" type=\"application/atom+xml\"/>
|
||||||
<description>kageru’s blog</description>"
|
<description>Lucys blog</description>"
|
||||||
}
|
}
|
||||||
|
|
||||||
add_footer() {
|
add_footer() {
|
||||||
html_entry "legacy" "before 2020" "Older posts"
|
html_entry "https://asagi.moe" "before 07-2020" "Old site"
|
||||||
output '</table>'
|
output '</table>'
|
||||||
output_rss '</feed>'
|
output_rss '</feed>'
|
||||||
}
|
}
|
||||||
|
@ -56,8 +56,8 @@ create_entry() {
|
||||||
# convert new markdown posts to html
|
# convert new markdown posts to html
|
||||||
pandoc "$path" -t html -f markdown -o "$outpath"
|
pandoc "$path" -t html -f markdown -o "$outpath"
|
||||||
# then add it to the index
|
# then add it to the index
|
||||||
title="$(rg 'h1' "$outpath" | head -n1 | rg -o '(?<=>).*(?=<)' --pcre2)"
|
title="$(grep -h '^title: ' "$path" | sed 's/title: //g')"
|
||||||
created=$(git log --follow --format=%as "$path" | tail -1)
|
created=$(grep -h '^date: ' "$path" | sed 's/date: //g')
|
||||||
html_entry "$outpath" "created on $created" "$title"
|
html_entry "$outpath" "created on $created" "$title"
|
||||||
rss_entry "$title" "$outpath"
|
rss_entry "$title" "$outpath"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user