Initial commit
This commit is contained in:
45
rss.sh
Executable file
45
rss.sh
Executable file
@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
|
||||
BASEDIR="$(dirname "${0}" | sed "s|^\.|${PWD}|")"
|
||||
DATE="$(date -R)"
|
||||
|
||||
source "${BASEDIR}/website.conf"
|
||||
|
||||
|
||||
printf 'Title of blog post:\n'
|
||||
read -r TITLE
|
||||
|
||||
printf 'Link to blog post:\n'
|
||||
read -r LINK
|
||||
LINK="$(printf "${LINK}" | sed 's|^/||')"
|
||||
|
||||
printf 'Description of blog post:\n'
|
||||
read -r DESCRIPTION
|
||||
|
||||
|
||||
cat << EOF | tee "${WEBROOT}/blog/feed.rss" &> /dev/null
|
||||
$(cat "${WEBROOT}/blog/feed.rss" | sed '/<last.*$/Q')
|
||||
<lastBuildDate>
|
||||
${DATE}
|
||||
</lastBuildDate>
|
||||
<item>
|
||||
<title>
|
||||
${TITLE}
|
||||
</title>
|
||||
<link>
|
||||
${WEBSITE_URL}/${LINK}
|
||||
</link>
|
||||
<guid>
|
||||
$(uuidgen)
|
||||
</guid>
|
||||
<pubDate>
|
||||
${DATE}
|
||||
</pubDate>
|
||||
<description>
|
||||
${DESCRIPTION}
|
||||
</description>
|
||||
</item>
|
||||
$(cat "${WEBROOT}/blog/feed.rss" | sed '1,29d')
|
||||
EOF
|
Reference in New Issue
Block a user