Fixing atom generation and metadata
This commit is contained in:
parent
b6769e6d2e
commit
a45165d6d3
|
@ -3,7 +3,7 @@ generate-site:
|
|||
./make_issue.sh _index ../public/index.html
|
||||
./sitemap.sh webzine.puffy.cafe ../public/ > ../public/sitemap.xml
|
||||
gzip -9 -c ../public/sitemap.xml > ../public/sitemap.gz
|
||||
./atom.sh webzine.puffy.cafe ../public/ > ../public/atom.xml
|
||||
./atom.sh webzine.puffy.cafe > ../public/atom.xml
|
||||
|
||||
all: generate-site
|
||||
|
||||
|
|
|
@ -1,43 +1,45 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
domain="$1"
|
||||
cd "$2"
|
||||
|
||||
feed_updated=$(date +%Y-%m-%dT%TZ)
|
||||
# exit if no public issue found
|
||||
ls ../public/issue-*.html >/dev/null 2>&1
|
||||
|
||||
date_updated=$(date +%Y-%m-%dT%TZ)
|
||||
|
||||
cat <<EOF
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
<id>https://${domain}/log/</id>
|
||||
<title>OpenBSD Webzine</title>
|
||||
<icon>https://${domain}/favicon.png</icon>
|
||||
<link rel="alternate" type="text/html" href="https://${domain}/" />
|
||||
<link rel="self" type="application/atom+xml" href="https://${domain}/atom.xml" />
|
||||
<author><name>OpenBSD Webzine contributors</name></author>
|
||||
<updated>${feed_updated}</updated>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
<id>https://${domain}/log/</id>
|
||||
<title>OpenBSD Webzine</title>
|
||||
<icon>https://${domain}/favicon.png</icon>
|
||||
<link rel="alternate" type="text/html" href="https://${domain}/" />
|
||||
<link rel="self" type="application/atom+xml" href="https://${domain}/atom.xml" />
|
||||
<author>
|
||||
<name>OpenBSD Webzine contributors</name>
|
||||
</author>
|
||||
<updated>${date_updated}</updated>
|
||||
EOF
|
||||
|
||||
for page in *.html; do
|
||||
updated="$(date -ur $(stat -f %m ${page}) +%Y-%m-%dT%TZ)"
|
||||
for page in ../public/issue-*.html ; do
|
||||
issue=$(echo $page | grep -oE "issue\-[0-9]+")
|
||||
title=$(echo $issue | awk -F '-' '{ print "Issue #"$NF }')
|
||||
. ./$issue/metadata.sh
|
||||
tag="$(echo -n ${issue} | sha256)"
|
||||
|
||||
title="${page%-.*}"
|
||||
tag="$(echo -n ${page} | sha256)"
|
||||
|
||||
cat <<EOF
|
||||
<entry>
|
||||
<title type="text">${title}</title>
|
||||
<id>tag:${domain},2021:${tag}</id>
|
||||
<updated>${updated}</updated>
|
||||
<link rel="alternate" type="text/html" href="https://${domain}/${page}" />
|
||||
<content type="html">
|
||||
cat <<EOF
|
||||
<entry>
|
||||
<title type="text">${title}</title>
|
||||
<id>tag:${domain},2021:${tag}</id>
|
||||
<updated>${PUBLISHED_DATE}</updated>
|
||||
<link rel="alternate" type="text/html" href="https://${domain}/${issue}.html" />
|
||||
<content type="html">
|
||||
<![CDATA[
|
||||
$(cat $page)
|
||||
]]>
|
||||
</content>
|
||||
</entry>
|
||||
</entry>
|
||||
EOF
|
||||
done
|
||||
|
||||
echo "</feed>"
|
||||
|
||||
exit
|
||||
|
|
|
@ -18,6 +18,8 @@ test -d "$DIR" || usage
|
|||
test -d ../public/ || die "You must run this from openbsd-webzine/current"
|
||||
ls $DIR/*.html 2>&1 >/dev/null || die "no html file in $DIR"
|
||||
|
||||
. ./${DIR}/metadata.sh
|
||||
|
||||
if [ "$(stat -f '%i' $DIR)" -eq "$CURINODE" ]
|
||||
then
|
||||
DEST=dev
|
||||
|
@ -37,4 +39,4 @@ issue="${1#issue-}"
|
|||
sed -i "s/__ISSUE__/${issue}/g" $DESTFILENAME
|
||||
|
||||
# replace date
|
||||
sed -i "s/__DATE__/$(date -u)/" $DESTFILENAME
|
||||
sed -i "s/__DATE__/${PUBLISHED_DATE}/" $DESTFILENAME
|
||||
|
|
Loading…
Reference in New Issue