mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-28 14:40:43 +03:00
hugolib: Improve render error handling
Catch and return the "template not found" error earlier.
This commit is contained in:
parent
04d80e6e87
commit
868f89d5c6
2 changed files with 14 additions and 45 deletions
|
@ -19,6 +19,8 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/spf13/hugo/helpers"
|
||||
|
||||
"github.com/spf13/hugo/output"
|
||||
|
||||
bp "github.com/spf13/hugo/bufferpool"
|
||||
|
@ -333,13 +335,12 @@ func (s *Site) renderRobotsTXT() error {
|
|||
rLayouts := []string{"robots.txt", "_default/robots.txt", "_internal/_default/robots.txt"}
|
||||
outBuffer := bp.GetBuffer()
|
||||
defer bp.PutBuffer(outBuffer)
|
||||
err := s.renderForLayouts("robots", n, outBuffer, s.appendThemeTemplates(rLayouts)...)
|
||||
|
||||
if err == nil {
|
||||
err = s.publish("robots.txt", outBuffer)
|
||||
if err := s.renderForLayouts("robots", n, outBuffer, s.appendThemeTemplates(rLayouts)...); err != nil {
|
||||
helpers.DistinctWarnLog.Println(err)
|
||||
return nil
|
||||
}
|
||||
|
||||
return err
|
||||
return s.publish("robots.txt", outBuffer)
|
||||
}
|
||||
|
||||
// renderAliases renders shell pages that simply have a redirect in the header.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue