-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Description
The problem
While this is possible and recommended to define any mediaType's extensions as an array of suffixes, it is not currently possible to choose which suffix to use when generating a file from an output format.
To clarify, if I...
- add the
rsssuffix to the built-inapplication/rss+xmlmedia - and use this media type on custom output format
# 1
mediaTypes:
application/rss+xml:
suffixes:
- xml
- rss
# 2
outputFormats:
rss_feed:
mediaType: application/rss+xml
baseName: feedThe rss_feed output format will generate a feed.xml file, using the first suffix.
Even though several suffixes are declared on the media type, it is impossible to choose one when assigning it to an output format.
proposed solution 1 (as suggested here)
Adding a suffix key to the outputFormat.
If set, Hugo would use the given suffix when generating the file.
If not set, current behaviour prevails, it would use the first suffix.
# 2
outputFormats:
rss_feed:
mediaType: application/rss+xml
baseName: feed
suffix: rssWould generate /feed.rss
proposed solution 2
Use the extension of the template file if matching any of the mediaType suffixes.
if index.rss_feed.rss is found, this means the file should be generated at feed.rss
if index.rss_feed.xml is found, this means the file should be generated at feed.xml
If both files are found, first suffix of the set output format should be used or both files could be created...