diff options
author | Nathan Friend <nathan@gitlab.com> | 2021-08-20 13:52:09 +0300 |
---|---|---|
committer | Nathan Friend <nathan@gitlab.com> | 2021-08-20 13:52:09 +0300 |
commit | 5fff32dd852a27151a08dea0cb2a8fd2983d7f65 (patch) | |
tree | 0e5c56af88f83f1550bbaf90f433eda4da7cfd5d /internal/redirects/helpers.go | |
parent | ca330e78ad92ea79939a5df9b70f3c627a62eecf (diff) |
Splat and placeholder support in _redirects
This commit adds support for Netlify-style splats (*) and :placeholders
in the _redirects file.
Changelog: added
Diffstat (limited to 'internal/redirects/helpers.go')
-rw-r--r-- | internal/redirects/helpers.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/redirects/helpers.go b/internal/redirects/helpers.go index 4223faae..52ae7991 100644 --- a/internal/redirects/helpers.go +++ b/internal/redirects/helpers.go @@ -1,6 +1,7 @@ package redirects import ( + "os" "strings" ) @@ -9,3 +10,9 @@ import ( func normalizePath(path string) string { return strings.TrimSuffix(path, "/") + "/" } + +// placeholdersEnabled returns whether or not placeholders and splats +// are enabled for use in the _redirects file. +func placeholdersEnabled() bool { + return os.Getenv(FFEnablePlaceholders) == "true" +} |