diff options
author | Nathaniel Peiffer <nathaniel@peiffer.com.au> | 2018-10-16 17:36:27 +1100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-10-16 08:36:27 +0200 |
commit | 92979d92889ff8991acfadd42982c2e55d01b163 (patch) | |
tree | 3fe5e2bf7120b5b3d7762298ddc9fdb7e7cc9578 | |
parent | 0a3340e95254597bc8a9feb250f2733b7d51edf8 (diff) |
commands: Add .gitignore "hugo new site"
-rw-r--r-- | commands/new_site.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/commands/new_site.go b/commands/new_site.go index 3e4cf4561..3d62bd44c 100644 --- a/commands/new_site.go +++ b/commands/new_site.go @@ -97,6 +97,7 @@ func (n *newSiteCmd) doNewSite(fs *hugofs.Fs, basepath string, force bool) error } createConfig(fs, basepath, n.configFormat) + createGitignore(fs, basepath) // Create a default archetype file. helpers.SafeWriteToDisk(filepath.Join(archeTypePath, "default.md"), @@ -141,6 +142,14 @@ func createConfig(fs *hugofs.Fs, inpath string, kind string) (err error) { 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 { var nextStepsText bytes.Buffer |