From 2d9d085c852322a89191e79ab516bb0fb4070f78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mass=C3=A9?= Date: Fri, 12 Jul 2024 13:29:39 +0200 Subject: [PATCH] find internal redirects --- find-internal-redirects | 66 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 find-internal-redirects diff --git a/find-internal-redirects b/find-internal-redirects new file mode 100755 index 0000000..1ae74fe --- /dev/null +++ b/find-internal-redirects @@ -0,0 +1,66 @@ +#!/bin/bash + +set -Eeuo pipefail + +declare -a exit_hooks=() +function cleanup () { + for hook in "${exit_hooks[@]}"; do + echo "Running cleanup hook: $hook" + eval "$hook" + done +} +trap "cleanup" EXIT +function addExitHook () { + exit_hooks+=("$1") +} + +DEST="$(mktemp -d -t 'hugo-href-check.XXXXXX')" +addExitHook "rm -rf \$DEST" +echo "All artefacts will be generated in $DEST" + +#echo "Generating and serving content..." +#./hugo serve -p 1313 -b http://localhost:1313/ --disableLiveReload --disableBrowserError --watch false --logLevel info --quiet --appendPort false &>"$DEST/hugo.log" & +#addExitHook "pkill -e --ignore-ancestors --full '^hugo'" + +echo "Generating content..." +mkdir -p "$DEST/html" "$DEST/nginx" +./hugo -b http://localhost:1313/ -d "$DEST/html" + +echo "Serving content with nginx..." +cat > "$DEST/nginx.conf" <