summaryrefslogtreecommitdiffstats
path: root/hugolib/page_paths.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-06-20 08:45:52 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-06-20 11:04:14 +0200
commit0f40e1fadfca2276f65adefa6d7d5d63aef9160a (patch)
tree7bd0a02e660facfa8200ad3b9adf68ff3c7f3e3d /hugolib/page_paths.go
parent516e6c6dc5733cdaf985317d58eedbc6ec0ef2f7 (diff)
media, hugolib: Support extension-less media types
This change is motivated by Netlify's `_redirects` files, which is currently not possible to generate with Hugo. This commit adds a `Delimiter` field to media type, which defaults to ".", but can be blanked out. Fixes #3614
Diffstat (limited to 'hugolib/page_paths.go')
-rw-r--r--hugolib/page_paths.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/hugolib/page_paths.go b/hugolib/page_paths.go
index 8aa70b95b..73fd62278 100644
--- a/hugolib/page_paths.go
+++ b/hugolib/page_paths.go
@@ -164,7 +164,7 @@ func createTargetPath(d targetPathDescriptor) string {
if d.URL != "" {
pagePath = filepath.Join(pagePath, d.URL)
if strings.HasSuffix(d.URL, "/") || !strings.Contains(d.URL, ".") {
- pagePath = filepath.Join(pagePath, d.Type.BaseName+"."+d.Type.MediaType.Suffix)
+ pagePath = filepath.Join(pagePath, d.Type.BaseName+d.Type.MediaType.FullSuffix())
}
} else {
if d.ExpandedPermalink != "" {
@@ -184,9 +184,9 @@ func createTargetPath(d targetPathDescriptor) string {
}
if isUgly {
- pagePath += "." + d.Type.MediaType.Suffix
+ pagePath += d.Type.MediaType.Delimiter + d.Type.MediaType.Suffix
} else {
- pagePath = filepath.Join(pagePath, d.Type.BaseName+"."+d.Type.MediaType.Suffix)
+ pagePath = filepath.Join(pagePath, d.Type.BaseName+d.Type.MediaType.FullSuffix())
}
if d.LangPrefix != "" {
@@ -207,7 +207,7 @@ func createTargetPath(d targetPathDescriptor) string {
base = helpers.FilePathSeparator + d.Type.BaseName
}
- pagePath += base + "." + d.Type.MediaType.Suffix
+ pagePath += base + d.Type.MediaType.FullSuffix()
if d.LangPrefix != "" {
pagePath = filepath.Join(d.LangPrefix, pagePath)