commit 76f3c0e3e23b911d7ea257b2987c0cf51b502d04
parent ea500adc9fbd8b4ecc7db800a01934ebc11a7544
Author: Francesco Saccone <francesco@francescosaccone.com>
Date: Sun, 9 Mar 2025 17:43:51 +0100
fix: make sure sitemap URL paths are correctly formatted
Before this, the index URL had incorrect path "/." and the other URLs did not
end with a trailing slash. Now everything has been fixed, with the index URL
having path "/" and the others having the trailing slash character.
Signed-off-by: Francesco Saccone <francesco@francescosaccone.com>
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/scripts/generate-sitemap.sh b/scripts/generate-sitemap.sh
@@ -27,7 +27,13 @@ mkdir -p "$DESTINATION"
for md_file in $(find "$SOURCE" -type f -name "index.md"); do
md_relative_file="${md_file#$SOURCE/}"
- url="$BASE_URL/$(dirname $md_relative_file)"
+ if [ "$md_relative_file" = "index.md" ]; then
+ url_path=""
+ else
+ url_path="$(dirname $md_relative_file)/"
+ fi
+
+ url="$BASE_URL/$url_path"
{
echo -n "<url>"