Repository: gohugoio/hugo (language: go)

Issue:
TOML and YAML archetypes missing delimiters
JSON archetypes are fine.

This is an embarrassing bug, introduced in https://github.com/gohugoio/hugo/pull/12928, which would have been caught had I created some decent test cases. 

We'll need a patch release on this one.




Discussion / hints:

Fix patch:
diff --git a/create/skeletons/skeletons.go b/create/skeletons/skeletons.go
index 802b15fb09f..54b6695226d 100644
--- a/create/skeletons/skeletons.go
+++ b/create/skeletons/skeletons.go
@@ -123,7 +123,7 @@ func newSiteCreateArchetype(fs afero.Fs, createpath string, format string) (err
 	}
 
 	var buf bytes.Buffer
-	err = parser.InterfaceToConfig(in, metadecoders.FormatFromString(format), &buf)
+	err = parser.InterfaceToFrontMatter(in, metadecoders.FormatFromString(format), &buf)
 	if err != nil {
 		return err
 	}


Test patch:
diff --git a/testscripts/commands/new.txt b/testscripts/commands/new.txt
index 4ac264eb175..9057f9972a4 100644
--- a/testscripts/commands/new.txt
+++ b/testscripts/commands/new.txt
@@ -65,6 +65,20 @@ cd myexistingsite
 hugo new post/foo.md -t mytheme
 grep 'Dummy content' content/post/foo.md
 
+cd $WORK
+
+# In the three archetype format tests below, skip Windows testing to avoid
+# newline differences when comparing to golden.
+
+hugo new site json-site --format json
+[!windows] cmp json-site/archetypes/default.md archetype-golden-json.md
+
+hugo new site toml-site --format toml
+[!windows] cmp toml-site/archetypes/default.md archetype-golden-toml.md
+
+hugo new site yaml-site --format yaml
+[!windows] cmp yaml-site/archetypes/default.md archetype-golden-yaml.md
+
 -- myexistingsite/hugo.toml --
 theme = "mytheme"
 -- myexistingsite/content/p1.md --
@@ -80,3 +94,22 @@ draft: true
 ---
 
 Dummy content.
+
+-- archetype-golden-json.md --
+{
+   "date": "{{ .Date }}",
+   "draft": true,
+   "title": "{{ replace .File.ContentBaseName \"-\" \" \" | title }}"
+}
+-- archetype-golden-toml.md --
++++
+date = '{{ .Date }}'
+draft = true
+title = '{{ replace .File.ContentBaseName "-" " " | title }}'
++++
+-- archetype-golden-yaml.md --
+---
+date: '{{ .Date }}'
+draft: true
+title: '{{ replace .File.ContentBaseName "-" " " | title }}'
+---