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