added last modified dates (for autogenerated pages, it's last generated date)

This commit is contained in:
jan6 2021-11-16 17:10:08 +02:00
parent 78afbc91d0
commit 702564e31e
5 changed files with 24 additions and 8 deletions

2
.gitignore vendored
View File

@ -1,5 +1,5 @@
trigger_secret.txt
src/wiki
*.html
dist/
vendor/
signup/

View File

@ -3,6 +3,14 @@
#umask 0113
dir="$(echo "$0"|sed 's|/[^/]\+$||')"
if [ -d "$dir" ];then cd "$dir";fi
header="inc/header.html"
footer_start="inc/footer_start.html"
footer_end="inc/footer_end.html"
mdate(){
date="$(date -u -d "@$(stat -c %Y "$1" )" "+%Y-%m-%dT%H:%MZ")"
printf "%s<time datetime=%s>%s</time>\n" "${2:-Last Modified: }" "$date" "$(echo "$date"|sed 's/T/ /;s/Z/ UTC/')"
}
# no_ext removes the trailing .html,
# useful to tidy the URL, if you've set up your server to work with that in mind
@ -54,7 +62,9 @@ for path in . ./wiki;do
else
cat
fi |
cat inc/header.html - inc/footer.html >"dist/$dir/$filename.html"
cat "$header" - "$footer_start" >"dist/$dir/$filename.html"
mdate "src/$dir/$filename.md"|
cat - "$footer_end" >>"dist/$dir/$filename.html"
# ' \;
done
@ -62,12 +72,16 @@ done
echo "creating user list page.."
./users.sh|markdown|
cat inc/header.html - inc/footer.html > dist/users.html
cat "$header" - "$footer_start" > dist/users.html
mdate "dist/users.html" "Last Generated: "|
cat - "$footer_end" >> dist/users.html
echo "creating index page.."
./users.sh|
cat src/index.md -|markdown|
cat inc/header.html - inc/footer.html > dist/index.html
cat "$header" - "$footer_start" > dist/index.html
mdate "dist/index.html" "Last Generated: "|
cat - "$footer_end" >> dist/index.html
echo "creating index page for wiki..."
markdown "$tmpindex" |
@ -77,7 +91,9 @@ markdown "$tmpindex" |
else
cat
fi |
cat inc/header.html - inc/footer.html > dist/wiki/index.html
cat "$header" - "$footer_start" > dist/wiki/index.html
mdate "dist/wiki/index.html" "Last Generated: "|
cat - "$footer_end" >> dist/wiki/index.html
rm "$tmpindex"
echo "all done!"

View File

@ -1,4 +1,2 @@
</main>
<footer>
</footer>
</html>

2
inc/footer_start.html Normal file
View File

@ -0,0 +1,2 @@
</main>
<footer>

@ -1 +1 @@
Subproject commit 8851ad3fa0f12ab66d495302c1d30977bfc1bf01
Subproject commit b27cae389b469b4bd2c6e0abbd2e839fc8f9e758