From c1a6722b9369bfa54522f8028c7c5cde391ebf41 Mon Sep 17 00:00:00 2001 From: Richard Dern Date: Mon, 6 Apr 2026 16:17:55 +0200 Subject: [PATCH] Meilleure gestion des redirections --- config/_default/config.yaml | 10 ++++++++++ config/_default/outputs.yaml | 1 + layouts/home.redirects | 7 +++++++ 3 files changed, 18 insertions(+) create mode 100644 layouts/home.redirects diff --git a/config/_default/config.yaml b/config/_default/config.yaml index b1f6e8b0..79c26931 100644 --- a/config/_default/config.yaml +++ b/config/_default/config.yaml @@ -8,6 +8,7 @@ enableEmoji: true enableGitInfo: true timeZone: Europe/Paris theme: ["2026"] +disableAliases: true security: funcs: getenv: @@ -17,3 +18,12 @@ security: params: lists: layout: spotlight +mediaTypes: + text/redirects: + delimiter: "" +outputFormats: + redirects: + baseName: _redirects + isPlainText: true + mediaType: text/redirects + root: true diff --git a/config/_default/outputs.yaml b/config/_default/outputs.yaml index a70e98a3..1b4fb815 100644 --- a/config/_default/outputs.yaml +++ b/config/_default/outputs.yaml @@ -1,6 +1,7 @@ home: - html - rss + - redirects section: html taxonomy: html term: html diff --git a/layouts/home.redirects b/layouts/home.redirects new file mode 100644 index 00000000..ccd6880b --- /dev/null +++ b/layouts/home.redirects @@ -0,0 +1,7 @@ +{{- range site.RegularPages -}} + {{- $target := .RelPermalink -}} + {{- range .Aliases -}} + {{- $alias := replace . " " "%20" -}} + {{- printf "redir %s %s permanent\n" $alias $target -}} + {{- end -}} +{{- end -}} \ No newline at end of file