mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
create/skeletons: Add delimiters to archetype front matter
Fixes #12945
This commit is contained in:
parent
1cfe9741b9
commit
b1b3bbcdbd
2 changed files with 34 additions and 1 deletions
|
@ -123,7 +123,7 @@ func newSiteCreateArchetype(fs afero.Fs, createpath string, format string) (err
|
||||||
}
|
}
|
||||||
|
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
err = parser.InterfaceToConfig(in, metadecoders.FormatFromString(format), &buf)
|
err = parser.InterfaceToFrontMatter(in, metadecoders.FormatFromString(format), &buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,6 +65,20 @@ cd myexistingsite
|
||||||
hugo new post/foo.md -t mytheme
|
hugo new post/foo.md -t mytheme
|
||||||
grep 'Dummy content' content/post/foo.md
|
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 --
|
-- myexistingsite/hugo.toml --
|
||||||
theme = "mytheme"
|
theme = "mytheme"
|
||||||
-- myexistingsite/content/p1.md --
|
-- myexistingsite/content/p1.md --
|
||||||
|
@ -80,3 +94,22 @@ draft: true
|
||||||
---
|
---
|
||||||
|
|
||||||
Dummy content.
|
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 }}'
|
||||||
|
---
|
||||||
|
|
Loading…
Reference in a new issue