Skip to content

Commit

Permalink
commands: Add .gitignore "hugo new site"
Browse files Browse the repository at this point in the history
  • Loading branch information
napei authored and bep committed Oct 16, 2018
1 parent 0a3340e commit 92979d9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions commands/new_site.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 92979d9

Please sign in to comment.