aboutsummaryrefslogtreecommitdiffhomepage
path: root/output
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2024-01-31 09:43:02 +0100
committerBjørn Erik Pedersen <[email protected]>2024-01-31 09:43:02 +0100
commit309d61b22064e59f17d3d8cc44b02d9007e24dcb (patch)
tree2500bf637ab4c71833ab99503a7a3725f385ab52 /output
parent5b7cb258ec26d7de690099f5dc39935b8d728155 (diff)
downloadhugo-309d61b22064e59f17d3d8cc44b02d9007e24dcb.tar.gz
hugo-309d61b22064e59f17d3d8cc44b02d9007e24dcb.zip
output: Prevent setting Name directly in new output formats
Name is derived from the map key. Closes #11947
Diffstat (limited to 'output')
-rw-r--r--output/config.go2
-rw-r--r--output/outputFormat.go2
2 files changed, 2 insertions, 2 deletions
diff --git a/output/config.go b/output/config.go
index a7ebf5107..09d29f184 100644
--- a/output/config.go
+++ b/output/config.go
@@ -65,10 +65,10 @@ func DecodeConfig(mediaTypes media.Types, in any) (*config.ConfigNamespace[map[s
}
newOutFormat := defaultOutputFormat
- newOutFormat.Name = k
if err := decode(mediaTypes, v, &newOutFormat); err != nil {
return f, nil, err
}
+ newOutFormat.Name = k
f = append(f, newOutFormat)
diff --git a/output/outputFormat.go b/output/outputFormat.go
index 54e7fe98d..981d895b6 100644
--- a/output/outputFormat.go
+++ b/output/outputFormat.go
@@ -29,7 +29,7 @@ type Format struct {
// The Name is used as an identifier. Internal output formats (i.e. html and rss)
// can be overridden by providing a new definition for those types.
// <docsmeta>{ "identifiers": ["html", "rss"] }</docsmeta>
- Name string `json:"name"`
+ Name string `json:"-"`
MediaType media.Type `json:"-"`