From 752ddd749a5d4d6e78ff42d58f2fa0e679ffabc9 Mon Sep 17 00:00:00 2001 From: Dave Glick Date: Tue, 1 Dec 2020 16:57:09 -0500 Subject: [PATCH] Added media type for .fhtml --- RELEASE.md | 1 + src/core/Statiq.Common/Content/MediaTypes.cs | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 63a14b057..e9d9a04de 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -2,6 +2,7 @@ - Added some additional retry policies to file operations to avoid file lock exceptions under certain conditions (#151). - Added ability to customize the body of meta-refresh redirect HTML files using the `RedirectBody` key (#153). +- Added `.fhtml` as a media type to mean HTML fragments (needed so that we can treat full HTML and HTML fragments differently when applying layouts in Statiq Web). # 1.0.0-beta.30 diff --git a/src/core/Statiq.Common/Content/MediaTypes.cs b/src/core/Statiq.Common/Content/MediaTypes.cs index ea3974b08..4df63e0ce 100644 --- a/src/core/Statiq.Common/Content/MediaTypes.cs +++ b/src/core/Statiq.Common/Content/MediaTypes.cs @@ -12,21 +12,22 @@ public static class MediaTypes { // Some common and relevant media types // Use lookups to make sure we reflect any changes to the mapping + public static string CSharp => Get(".cs"); public static string Css => Get(".css"); public static string Gif => Get(".gif"); public static string Handlebars => Get(".hbs"); public static string Html => Get(".html"); + public static string HtmlFragment => Get(".fhtml"); public static string Jpg => Get(".jpg"); public static string Json => Get(".json"); + public static string Less => Get(".less"); public static string Markdown => Get(".md"); public static string Png => Get(".png"); public static string Razor => Get(".cshtml"); - public static string Less => Get(".less"); public static string Sass => Get(".sass"); public static string Scss => Get(".scss"); public static string Xml => Get(".xml"); public static string Yaml => Get(".yaml"); - public static string CSharp => Get(".cs"); /// /// A mapping of file extension to both registered IANA media types @@ -1058,17 +1059,18 @@ async Task Main() // Additional conventional media types not registered with IANA // This is a good resource for finding conventional extensions: https://github.com/github/linguist/blob/master/lib/linguist/languages.yml + { ".cs", "text/x-csharp" }, { ".cshtml", "text/x-cshtml" }, // This is what VSCode uses: https://github.com/aspnet/AspNetCore-Tooling/blob/master/src/Razor/src/Microsoft.AspNetCore.Razor.VSCode.Extension/package.json + { ".csx", "text/x-csharp" }, + { ".fhtml", "text/x-fhtml" }, // HTML fragment, discussion at https://stackoverflow.com/q/811887 + { ".handlebars", "text/handlebars" }, + { ".hbs", "text/handlebars" }, { ".md", "text/markdown" }, { ".sass", "text/x-sass" }, { ".scss", "text/x-scss" }, - { ".yaml", "text/yaml" }, - { ".yml", "text/yaml" }, { ".wasm", "application/wasm" }, - { ".hbs", "text/handlebars" }, - { ".handlebars", "text/handlebars" }, - { ".cs", "text/x-csharp" }, - { ".csx", "text/x-csharp" } + { ".yaml", "text/yaml" }, + { ".yml", "text/yaml" } }; ///