summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-06-22 20:39:55 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-06-22 22:00:42 +0200
commitfd924d1802cb9c20c2617b1c72dac6bc36560d61 (patch)
tree890a074f2aa1eebee956ed3e8ac8db2b3ed19140 /commands
parente908d955d25cc5a2a5c783de4de569399773e23e (diff)
commands: Create default archetype on new site
See #3626
Diffstat (limited to 'commands')
-rw-r--r--commands/new.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/commands/new.go b/commands/new.go
index a7243c0a6..de922fc0d 100644
--- a/commands/new.go
+++ b/commands/new.go
@@ -152,10 +152,11 @@ func NewContent(cmd *cobra.Command, args []string) error {
}
func doNewSite(fs *hugofs.Fs, basepath string, force bool) error {
+ archeTypePath := filepath.Join(basepath, "archetypes")
dirs := []string{
filepath.Join(basepath, "layouts"),
filepath.Join(basepath, "content"),
- filepath.Join(basepath, "archetypes"),
+ archeTypePath,
filepath.Join(basepath, "static"),
filepath.Join(basepath, "data"),
filepath.Join(basepath, "themes"),
@@ -190,6 +191,10 @@ func doNewSite(fs *hugofs.Fs, basepath string, force bool) error {
createConfig(fs, basepath, configFormat)
+ // Create a defaul archetype file.
+ helpers.SafeWriteToDisk(filepath.Join(archeTypePath, "default.md"),
+ strings.NewReader(create.ArchetypeTemplateTemplate), fs.Source)
+
jww.FEEDBACK.Printf("Congratulations! Your new Hugo site is created in %s.\n\n", basepath)
jww.FEEDBACK.Println(nextStepsText())