merge branches

This commit is contained in:
Solene Rapenne 2021-09-29 18:52:37 +02:00
commit 8b05e196d8
11 changed files with 99 additions and 8 deletions

View File

@ -1,8 +1,11 @@
TEMPDIR=/tmp/openbsd-webzine/
generate-site: clean
ls | grep issue- | sort -n | xargs ./make_issue.sh
./make_issue.sh _index ../public/index.html
generate-site:
ls | grep issue- | sort -n | xargs tools/make_issue.sh
tools/make_issue.sh _index ../public/index.html
tools/sitemap.sh webzine.puffy.cafe ../public/ > ../public/sitemap.xml
gzip -9 -c ../public/sitemap.xml > ../public/sitemap.gz
tools/atom.sh webzine.puffy.cafe > ../public/atom.xml
all: generate-site
@ -11,12 +14,12 @@ clean:
test:
mkdir -p ${TEMPDIR}
./make_issue.sh current ${TEMPDIR}/current-issue.html
tools/make_issue.sh current ${TEMPDIR}/current-issue.html
xdg-open ${TEMPDIR}/current-issue.html
testsite: clean
ls | grep issue- | sort -n | xargs ./make_issue.sh -t
./make_issue.sh _index ../public/index.html
ls | grep issue- | sort -n | xargs tools/make_issue.sh -t
tools/make_issue.sh _index ../public/index.html
mkdir -p ${TEMPDIR}
cp -fr ../public ${TEMPDIR}/
xdg-open ${TEMPDIR}/public/index.html

View File

@ -2,6 +2,9 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<title>OpenBSD_WEBZINE_ISSUE #__ISSUE__</title>
<style>

45
issues/tools/atom.sh Executable file
View File

@ -0,0 +1,45 @@
#!/bin/sh
set -e
domain="$1"
# 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>${date_updated}</updated>
EOF
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)"
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>
EOF
done
echo "</feed>"

View File

@ -25,7 +25,9 @@ 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"
if [ $testsite -eq 0 ] && [ "$(stat -f '%i' $DIR)" -eq "$CURINODE" ]
. ./${DIR}/metadata.sh
if [ "$(stat -f '%i' $DIR)" -eq "$CURINODE" ]
then
DEST=dev
else
@ -44,4 +46,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

21
issues/tools/sitemap.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh
ndd="$1"
printf '%s\n' \
'<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'
cd "$2"
find . -name \*.html | while read -r l
do
link="$(printf "%s" ${l} | cut -d'/' -f2-)"
printf '<url><loc>%s</loc><lastmod>%s</lastmod></url>\n' \
"https://${ndd}/${link}"\
"$(date -r $(stat -f %m ${l}) +%Y-%m-%d)"
done
printf '%s' '</urlset>'

BIN
public/apple-touch-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

BIN
public/favicon-16x16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

BIN
public/favicon-32x32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

13
public/humans.txt Normal file
View File

@ -0,0 +1,13 @@
/* SITE */
Site name : OpenBSD Webzine
Site url : https://webzine.puffy.cafe
Built with (CMS) : coffee, tea and love
Created on : 2021
Language : English
Hosted by : prx's house
/* AUTHORS */
See contributors on https://tildegit.org/solene/openbsd-webzine
/* LINKS */
Follow (ATOM) : https://webzine.puffy.cafe/atom.xml

4
public/robots.txt Normal file
View File

@ -0,0 +1,4 @@
User-agent: *
Disallow:
Crawl-delay: 2
Sitemap: https://webzine.puffy.cafe/sitemap.gz