aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--create/skeletons/site/archetypes/default.md5
-rw-r--r--create/skeletons/skeletons.go21
2 files changed, 21 insertions, 5 deletions
diff --git a/create/skeletons/site/archetypes/default.md b/create/skeletons/site/archetypes/default.md
deleted file mode 100644
index c6f3fcef6..000000000
--- a/create/skeletons/site/archetypes/default.md
+++ /dev/null
@@ -1,5 +0,0 @@
-+++
-title = '{{ replace .File.ContentBaseName "-" " " | title }}'
-date = {{ .Date }}
-draft = true
-+++
diff --git a/create/skeletons/skeletons.go b/create/skeletons/skeletons.go
index aec79c149..802b15fb0 100644
--- a/create/skeletons/skeletons.go
+++ b/create/skeletons/skeletons.go
@@ -76,6 +76,11 @@ func CreateSite(createpath string, sourceFs afero.Fs, force bool, format string)
return err
}
+ err = newSiteCreateArchetype(sourceFs, createpath, format)
+ if err != nil {
+ return err
+ }
+
return copyFiles(createpath, sourceFs, siteFs)
}
@@ -109,3 +114,19 @@ func newSiteCreateConfig(fs afero.Fs, createpath string, format string) (err err
return helpers.WriteToDisk(filepath.Join(createpath, "hugo."+format), &buf, fs)
}
+
+func newSiteCreateArchetype(fs afero.Fs, createpath string, format string) (err error) {
+ in := map[string]any{
+ "title": "{{ replace .File.ContentBaseName \"-\" \" \" | title }}",
+ "date": "{{ .Date }}",
+ "draft": true,
+ }
+
+ var buf bytes.Buffer
+ err = parser.InterfaceToConfig(in, metadecoders.FormatFromString(format), &buf)
+ if err != nil {
+ return err
+ }
+
+ return helpers.WriteToDisk(filepath.Join(createpath, "archetypes", "default.md"), &buf, fs)
+}