Skip to content

Commit

Permalink
Print error when /index.html is zero-length
Browse files Browse the repository at this point in the history
Also print warning (in verbose mode) for other empty pages.

See #947
  • Loading branch information
anthonyfok committed Dec 2, 2015
1 parent f830276 commit 0d1d33d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions hugolib/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -1478,6 +1478,20 @@ func (s *Site) renderAndWritePage(name string, dest string, d interface{}, layou
transformer := transform.NewChain(transformLinks...)
transformer.Apply(outBuffer, renderBuffer, path)

if outBuffer.Len() == 0 {
jww.WARN.Printf("%q is rendered empty\n", dest)
if dest == "/" {
jww.ERROR.Println("=============================================================")
jww.ERROR.Println("Your rendered home page is blank: /index.html is zero-length")
jww.ERROR.Println(" * Did you specify a theme on the command-line or in your")
jww.ERROR.Printf(" %q file? (Current theme: %q)\n", filepath.Base(viper.ConfigFileUsed()), viper.GetString("Theme"))
if !viper.GetBool("Verbose") {
jww.ERROR.Println(" * For more debugging information, run \"hugo -v\"")
}
jww.ERROR.Println("=============================================================")
}
}

if err == nil {
if err = s.WriteDestPage(dest, outBuffer); err != nil {
return err
Expand Down

0 comments on commit 0d1d33d

Please sign in to comment.