From 2f6db565a92dcaac00e5ee23390ee46b573339c7 Mon Sep 17 00:00:00 2001 From: BBaoVanC Date: Wed, 8 Jul 2026 01:51:20 -0500 Subject: [PATCH] WIP: Add redirects in Netlify _redirects style using old guide Uses this guide: https://honnef.co/articles/generating-netlify-_redirects-from-hugo/ I didn't realize until after doing all this that there's a guide for the same thing in the official Hugo docs, so I'm about to migrate over to that. --- hugo.yaml | 17 +++++++++++++++++ layouts/home.REDIR | 7 +++++++ 2 files changed, 24 insertions(+) create mode 100644 layouts/home.REDIR diff --git a/hugo.yaml b/hugo.yaml index 5f40c77..c7bee03 100644 --- a/hugo.yaml +++ b/hugo.yaml @@ -21,6 +21,23 @@ taxonomies: outputs: page: - html + home: + - html + - rss + - REDIR + +outputFormats: + # https://honnef.co/articles/generating-netlify-_redirects-from-hugo/ + REDIR: + mediaType: text/caddy + baseName: _redirects + isPlainText: true + notAlternative: true + +mediaTypes: + # https://honnef.co/articles/generating-netlify-_redirects-from-hugo/ + text/caddy: + delimeter: "" privacy: googleAnalytics: diff --git a/layouts/home.REDIR b/layouts/home.REDIR new file mode 100644 index 0000000..606bc9c --- /dev/null +++ b/layouts/home.REDIR @@ -0,0 +1,7 @@ +{{ range hugo.Sites -}} +{{ range $p := .Pages -}} +{{ range .Aliases -}} +{{ . }} {{ $p.RelPermalink }} +{{ end -}} +{{ end -}} +{{ end -}}