Skip to content
/ hugo Public
forked from gohugoio/hugo

Commit

Permalink
create/skeletons: Add delimiters to archetype front matter
Browse files Browse the repository at this point in the history
  • Loading branch information
jmooring committed Oct 15, 2024
1 parent 1cfe974 commit 3cf9974
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion create/skeletons/skeletons.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
30 changes: 30 additions & 0 deletions testscripts/commands/new.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ cd myexistingsite
hugo new post/foo.md -t mytheme
grep 'Dummy content' content/post/foo.md

cd $WORK

hugo new site json-site --format json
cmp json-site/archetypes/default.md archetype-golden-json.md

hugo new site toml-site --format toml
cmp toml-site/archetypes/default.md archetype-golden-toml.md

hugo new site yaml-site --format yaml
cmp yaml-site/archetypes/default.md archetype-golden-yaml.md

-- myexistingsite/hugo.toml --
theme = "mytheme"
-- myexistingsite/content/p1.md --
Expand All @@ -80,3 +91,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 }}'
---

0 comments on commit 3cf9974

Please sign in to comment.