Reimplement and simplify Hugo's template system

See #13541 for details.

Fixes #13545
Fixes #13515
Closes #7964
Closes #13365
Closes #12988
Closes #4891
This commit is contained in:
Bjørn Erik Pedersen
2025-04-06 19:55:35 +02:00
parent 812ea0b325
commit 83cfdd78ca
138 changed files with 5342 additions and 4396 deletions

View File

@@ -133,6 +133,15 @@ var (
Weight: 10,
}
// Alias is the output format used for alias redirects.
AliasHTMLFormat = Format{
Name: "alias",
MediaType: media.Builtin.HTMLType,
IsHTML: true,
Ugly: true,
Permalinkable: false,
}
MarkdownFormat = Format{
Name: "markdown",
MediaType: media.Builtin.MarkdownType,
@@ -192,8 +201,17 @@ var (
Rel: "sitemap",
}
HTTPStatusHTMLFormat = Format{
Name: "httpstatus",
GotmplFormat = Format{
Name: "gotmpl",
MediaType: media.Builtin.GotmplType,
IsPlainText: true,
NotAlternative: true,
}
// I'm not sure having a 404 format is a good idea,
// for one, we would want to have multiple formats for this.
HTTPStatus404HTMLFormat = Format{
Name: "404",
MediaType: media.Builtin.HTMLType,
NotAlternative: true,
Ugly: true,
@@ -209,12 +227,16 @@ var DefaultFormats = Formats{
CSSFormat,
CSVFormat,
HTMLFormat,
GotmplFormat,
HTTPStatus404HTMLFormat,
AliasHTMLFormat,
JSONFormat,
MarkdownFormat,
WebAppManifestFormat,
RobotsTxtFormat,
RSSFormat,
SitemapFormat,
SitemapIndexFormat,
}
func init() {