diff options
author | Bjørn Erik Pedersen <[email protected]> | 2018-07-10 11:55:22 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2018-07-10 22:13:52 +0200 |
commit | b874a1ba7ab8394dc741c8c70303a30a35b63e43 (patch) | |
tree | 756a5869cf623ace8387fcf6166a831c052f0ae7 /hugolib/site_render.go | |
parent | 4108705934846f2b7cae2602ce14aeee17139608 (diff) | |
download | hugo-b874a1ba7ab8394dc741c8c70303a30a35b63e43.tar.gz hugo-b874a1ba7ab8394dc741c8c70303a30a35b63e43.zip |
media: Allow multiple file suffixes per media type
Before this commit, `Suffix` on `MediaType` was used both to set a custom file suffix and as a way to augment the mediatype definition (what you see after the "+", e.g. "image/svg+xml").
This had its limitations. For one, it was only possible with one file extension per MIME type.
Now you can specify multiple file suffixes using "suffixes", but you need to specify the full MIME type
identifier:
[mediaTypes]
[mediaTypes."image/svg+xml"]
suffixes = ["svg", "abc ]
In most cases, it will be enough to just change:
[mediaTypes]
[mediaTypes."my/custom-mediatype"]
suffix = "txt"
To:
[mediaTypes]
[mediaTypes."my/custom-mediatype"]
suffixes = ["txt"]
Hugo will still respect values set in "suffix" if no value for "suffixes" is provided, but this will be removed in a future release.
Note that you can still get the Media Type's suffix from a template: {{ $mediaType.Suffix }}. But this will now map to the MIME type filename.
Fixes #4920
Diffstat (limited to 'hugolib/site_render.go')
-rw-r--r-- | hugolib/site_render.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/hugolib/site_render.go b/hugolib/site_render.go index d6b7a76fc..2da4064b4 100644 --- a/hugolib/site_render.go +++ b/hugolib/site_render.go @@ -69,7 +69,7 @@ func headlessPagesPublisher(s *Site, wg *sync.WaitGroup) { defer wg.Done() for _, page := range s.headlessPages { outFormat := page.outputFormats[0] // There is only one - if outFormat != s.rc.Format { + if outFormat.Name != s.rc.Format.Name { // Avoid double work. continue } @@ -92,7 +92,7 @@ func pageRenderer(s *Site, pages <-chan *Page, results chan<- error, wg *sync.Wa for i, outFormat := range page.outputFormats { - if outFormat != page.s.rc.Format { + if outFormat.Name != page.s.rc.Format.Name { // Will be rendered ... later. continue } |