noxz-sites

A collection of a builder and various scripts creating the noxz.tech sites
git clone https://noxz.tech/git/noxz-sites.git
noxz-sites

commit: 650a556b99d534973e9b8d2ff59098537284c1b6
parent: 3ad748a14a7369cf93cea68ff020efb12da7b34c
author: Chris Noxz <chris@noxz.tech>
date:   Thu, 25 Aug 2022 19:15:41 +0200
publish 301 meta redirections
Aconfig/301.cfg4++++
Mpublish9+++++++++
2 files changed, 13 insertions(+)
diff --git a/config/301.cfg b/config/301.cfg
@@ -0,0 +1,4 @@
+/guides/groff/:/articles/sic_collection_of_papers_on_troff_and_its_companions/
+/guides/groff/writing_a_resume_in_groff/:/articles/writing_a_resume_in_groff/
+/guides/groff/simple_compiler_for_vim/:/articles/simple_groff_compiler_for_vim/
+/guides/mathematics/:/articles/divisibility_theorems_and_fraction_flipping/
diff --git a/publish b/publish
@@ -5,6 +5,15 @@ tmpdir="$(mktemp -d /tmp/.noxz.tech.sites.XXXXXX)"
 tar -xf "${1}" --strip-components 2 -C "${tmpdir}" \
 && echo "noxz.tech extracted to '${tmpdir}'"
 
+# add 301 redirections
+[ -f ./config/301.cfg ] && printf '\nprocessing 301:\n' && while read -r line
+do
+	mkdir -p "${tmpdir}/${line%:*}"
+	printf '<meta http-equiv="refresh" content="0; url=%s" />' "${line#*:}" \
+		> "${tmpdir}/${line%:*}/index.html"
+	printf '  %s > %s\n' "${line%:*}" "${line#*:}"
+done < ./config/301.cfg && printf '\n'
+
 if [ $? -eq 0 ]; then
 	echo "Synchronizing ${tmpdir}/ => ${2}"
 	echo "Are you sure [y/N]?"