From 5f31f3a1bf201f0bfde66c6e4657727fe02a94ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Tue, 20 Jun 2017 17:41:52 +0200 Subject: [PATCH] Replace aliases with Netlify's _redirects See https://github.com/gohugoio/hugo/issues/3613 See https://github.com/gohugoio/hugo/issues/3614 --- config.toml | 16 ++++++++++++++++ layouts/index.redir | 6 ++++++ 2 files changed, 22 insertions(+) create mode 100644 layouts/index.redir diff --git a/config.toml b/config.toml index b10b2f3cc12..c955f8ca27e 100644 --- a/config.toml +++ b/config.toml @@ -2,10 +2,26 @@ title = "Hugo: A Fast and Flexible Website Generator" baseurl = "http://gohugo.io/" MetaDataFormat = "yaml" pluralizeListTitles = false +# We do redirects via Netlify's _redirects file, generated by Hugo (see "outputs" below). +disableAliases = true [blackfriday] plainIDAnchors = true +[outputs] +home = [ "HTML", "RSS", "REDIR" ] + +[mediaTypes] +[mediaTypes."text/netlify"] +suffix = "" +delimiter = "" + +[outputFormats] +[outputFormats.REDIR] +mediatype = "text/netlify" +baseName = "_redirects" +isPlainText = true + [params] description = "Documentation of Hugo, a fast and flexible static site generator built with love by spf13, bep and friends in Go" author = "Steve Francia (spf13) and friends" diff --git a/layouts/index.redir b/layouts/index.redir new file mode 100644 index 00000000000..2dfd2bc0f49 --- /dev/null +++ b/layouts/index.redir @@ -0,0 +1,6 @@ +# Netlify redirects. See https://www.netlify.com/docs/redirects/ +{{ range $p := .Site.Pages -}} +{{ range .Aliases }} +{{ . | printf "%-35s" }} {{ $p.RelPermalink -}} +{{ end -}} +{{- end -}}