customize rss feed

This commit is contained in:
Lux49 2020-07-17 14:29:37 +02:00
parent e0ed767c63
commit 5e711b5f6b

View File

@ -22,7 +22,7 @@ add_header() {
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
<author><name>Lucy</name></author>
<title>Lucys blog</title>'
output_rss " <link href=\"$blog_domain\" rel=\"self\" type=\"application/atom+xml\"/>
output_rss " <link href=\"https://lucy.moe/rss.xml\" rel=\"self\" type=\"application/atom+xml\"/>
<description>Lucys blog</description>"
}
@ -34,12 +34,12 @@ add_footer() {
html_entry() {
output '<tr>'
path="$1"
webpath="$1"
time="$2"
title="$3"
output "<td class=\"first\"><a href=\"$path\">$title</a></td>"
output "<td class=\"second\">$time</td></tr>"
output_entrylist "[$title]($path)|$time"
output_entrylist "[$title]($webpath)|$time"
}
rss_entry() {
@ -48,13 +48,18 @@ rss_entry() {
# and with escaped html.
# The sed expression is stolen from https://stackoverflow.com/questions/12873682/12873723#12873723
output_rss " <entry>
<title>$1</title>
<link>$blog_domain$2</link>
<title type=\"text\">$1</title>
<published>$(date --rfc-3339=seconds -d $4 | sed 's/ /T/')</published>
<id>$blog_domain$2</id>
<link href=\"$blog_domain$2\" type=\"text/html\" title=\"$1\"/>
<summary type=\"html\">
$(grep -h '^<p>' "dist/$2" | head -n 1 | sed 's/^/ /')
</summary>
<content type=\"html\" xml:base=\"$blog_domain$2\">
$(tail -n+2 "$2" | sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g; s/"/\&quot;/g; s/'"'"'/\&#39;/g')
$(pandoc $3 | sed 's/^/ /')
</content>
</entry>"
# $(tail -n+2 "$2" | sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g; s/"/\&quot;/g; s/'"'"'/\&#39;/g')
}
create_entry() {
@ -66,7 +71,7 @@ create_entry() {
title=$(grep -h '<title>' "dist/$outpath" | sed 's/<title>//g;s/<\/title>//g')
created=$(grep -h '^date: ' "$path" | sed 's/date: //g')
html_entry "$outpath" "$created" "$title"
rss_entry "$title" "dist/$outpath"
rss_entry "$title" "$outpath" $path $created
}
convert_static() {
@ -85,7 +90,7 @@ has_updates() {
fi
}
cd /home/lucy/blog-content/
#cd /home/lucy/blog-content/
rm -R dist/*
rsync --delete -avxt static/ dist/
add_header