garbash-www

archive of ~alex garbash.com page
git clone git://git.alexkarle.com.com/garbash-www
Log | Files | Refs | README | LICENSE

commit 474b3eeed5d4578d3f7b082e59afd11a2964a559 (patch)
parent 620f763d6353c02f27e68c86acb31778422779be
Author: alex <alex@garbash.com>
Date:   Mon, 25 Oct 2021 00:32:49 -0400

build: Add a footer to all pages (but top level)

Pages can opt out with the "nofooter" frontmatter attribute.

Diffstat:
Mbin/buildpage | 18+++++++++++++++++-
Mroot-index.md | 1+
2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/bin/buildpage b/bin/buildpage @@ -24,12 +24,16 @@ html { font-size: 1em; font-family: sans-serif; } +footer { + font-size: .8em; +} </style> EOM # Print the title, if we find it in the frontmatter if [ "$(head -n1 "$1")" = "---" ]; then title="$(tail +2 "$1" | sed '/^---$/q' | grep '^title:' | sed 's/title: *//')" + nofooter="$(tail +2 "$1" | sed '/^---$/q' | grep '^nofooter:' | sed 's/nofooter: *//')" [ -n "$title" ] && printf "<title>$title</title>\n" start=$(awk '/^---$/ { c++; if (c == 2) { printf "%d\n", NR + 1; exit } }' "$1") else @@ -40,4 +44,16 @@ printf "</head>\n<body>\n" # Render the markdown starting from the end of the frontmatter! tail +$start "$1" | cmark --unsafe -printf "</body>\n</html>\n" +# Print a nav footer +if [ -z "$nofooter" ]; then + cat <<EOM +<br><br> +<footer> +<a href="/~alex">Home</a> | <a href="https://git.garbash.com/alex/www">Source</a> +</footer> +</body> +</html> +EOM +else + printf "</body>\n</html>\n" +fi diff --git a/root-index.md b/root-index.md @@ -1,5 +1,6 @@ --- title: garbash.com +nofooter: true --- Welcome