- config.toml: /config.toml
- index.redir: /layouts/index.redir
- redirects-json.yml: .forestry/front_matter/templates/redirects-json.yml
- redirects.json: /data/redirects.json
Last active
January 18, 2019 16:52
-
-
Save ZackBoe/99da0eb2d04145b146c3727494ef8a4f to your computer and use it in GitHub Desktop.
Generate netlify _redirects from Hugo data file for editing in Forestry.io
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[outputs] | |
home = ["HTML", "REDIR"] | |
[mediaTypes] | |
[mediaTypes."text/netlify"] | |
delimiter = "" | |
[outputFormats] | |
[outputFormats.REDIR] | |
mediatype = "text/netlify" | |
baseName = "_redirects" | |
isPlainText = true | |
notAlternative = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Netlify redirects. See https://www.netlify.com/docs/redirects/ | |
# Edit redirects in /data/redirects.json | |
{{ range $r := .Site.Data.redirects }} | |
{{ $r.from }} {{ $r.to }} {{ if $r.status }}{{ $r.status }}{{ end }} | |
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
label: redirects.json | |
hide_body: true | |
is_partial: false | |
fields: | |
- name: Redirects | |
label: Redirects | |
type: field_group_list | |
fields: | |
- name: from | |
label: From URL | |
type: text | |
hidden: false | |
default: '' | |
config: | |
required: true | |
description: URL to redirect from (/about.html) | |
- name: to | |
label: To URL | |
type: text | |
hidden: false | |
default: '' | |
config: | |
required: true | |
description: URL to redirect to (/about) | |
- name: status | |
label: Status | |
type: text | |
hidden: false | |
default: '' | |
description: 'Optional redirect status. Default: 301' | |
hidden: false | |
default: '' | |
description: 'Documentation: https://www.netlify.com/docs/redirects/' | |
pages: | |
- data/redirects.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"from": "/contact.html", | |
"to": "/contact", | |
"status": "" | |
}, | |
{ | |
"from": "/home.html", | |
"to": "/", | |
"status": 302 | |
}, | |
{ | |
"from": "/about.html", | |
"to": "/about" | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Gleaned from here: https://gohugo.io/news/http2-server-push-in-hugo/