shithub: hugo

Download patch

ref: 92979d92889ff8991acfadd42982c2e55d01b163
parent: 0a3340e95254597bc8a9feb250f2733b7d51edf8
author: Nathaniel Peiffer <[email protected]>
date: Tue Oct 16 13:36:27 EDT 2018

commands: Add .gitignore "hugo new site"


--- a/commands/new_site.go
+++ b/commands/new_site.go
@@ -97,6 +97,7 @@
 	}
 
 	createConfig(fs, basepath, n.configFormat)
+	createGitignore(fs, basepath)
 
 	// Create a default archetype file.
 	helpers.SafeWriteToDisk(filepath.Join(archeTypePath, "default.md"),
@@ -139,6 +140,14 @@
 	}
 
 	return helpers.WriteToDisk(filepath.Join(inpath, "config."+kind), &buf, fs.Source)
+}
+
+func createGitignore(fs *hugofs.Fs, inpath string) (err error) {
+	var gitignore bytes.Buffer
+
+	gitignore.WriteString("public/")
+
+	return helpers.WriteToDisk(filepath.Join(inpath, ".gitignore"), &gitignore, fs.Source)
 }
 
 func nextStepsText() string {