media: support application/manifest+json

The standard file extension for Web App Manifest files is
".webmanifest". This commit allows Hugo to recognize .webmanifest files
as "application/manifest+json" files and to minify them using its
JSON minifier.

The .webmanifest file extension is recommended in the w3c spec to
simplify media type registration:
https://www.w3.org/TR/appmanifest/#media-type-registration

Webhint docs are also relevant:
https://webhint.io/docs/user-guide/hints/hint-manifest-file-extension/

Closes #8624
This commit is contained in:
Rohan Kumar
2021-06-09 16:13:46 -07:00
committed by Bjørn Erik Pedersen
parent 402da3f8f3
commit 02f31897b4
3 changed files with 19 additions and 8 deletions

View File

@@ -143,6 +143,14 @@ var (
Rel: "alternate",
}
WebAppManifestFormat = Format{
Name: "WebAppManifest",
MediaType: media.WebAppManifestType,
BaseName: "manifest",
IsPlainText: true,
Rel: "manifest",
}
RobotsTxtFormat = Format{
Name: "ROBOTS",
MediaType: media.TextType,
@@ -176,6 +184,7 @@ var DefaultFormats = Formats{
CSVFormat,
HTMLFormat,
JSONFormat,
WebAppManifestFormat,
RobotsTxtFormat,
RSSFormat,
SitemapFormat,