mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-25 22:00:58 +02:00
Handle transient errors in config loading etc.
As in: Get the Kubernetes site to build with the new Hugo version. Updates #10947
This commit is contained in:
@@ -35,6 +35,9 @@ type Site interface {
|
||||
// Returns the Language configured for this Site.
|
||||
Language() *langs.Language
|
||||
|
||||
// Returns all the languages configured for all sites.
|
||||
Languages() langs.Languages
|
||||
|
||||
GetPage(ref ...string) (Page, error)
|
||||
|
||||
// AllPages returns all pages for all languages.
|
||||
@@ -94,6 +97,9 @@ type Site interface {
|
||||
// Returns the Params configured for this site.
|
||||
Params() maps.Params
|
||||
|
||||
// Param is a convenience method to do lookups in Params.
|
||||
Param(key any) (any, error)
|
||||
|
||||
// Returns a map of all the data inside /data.
|
||||
Data() map[string]any
|
||||
|
||||
@@ -174,6 +180,10 @@ func (s *siteWrapper) Language() *langs.Language {
|
||||
return s.s.Language()
|
||||
}
|
||||
|
||||
func (s *siteWrapper) Languages() langs.Languages {
|
||||
return s.s.Languages()
|
||||
}
|
||||
|
||||
func (s *siteWrapper) AllPages() Pages {
|
||||
return s.s.AllPages()
|
||||
}
|
||||
@@ -254,6 +264,10 @@ func (s *siteWrapper) Params() maps.Params {
|
||||
return s.s.Params()
|
||||
}
|
||||
|
||||
func (s *siteWrapper) Param(key any) (any, error) {
|
||||
return s.s.Param(key)
|
||||
}
|
||||
|
||||
func (s *siteWrapper) Data() map[string]any {
|
||||
return s.s.Data()
|
||||
}
|
||||
@@ -334,6 +348,10 @@ func (t testSite) Current() Site {
|
||||
return t
|
||||
}
|
||||
|
||||
func (t testSite) Languages() langs.Languages {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t testSite) GoogleAnalytics() string {
|
||||
return ""
|
||||
}
|
||||
@@ -410,6 +428,10 @@ func (s testSite) IsMultiLingual() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (s testSite) Param(key any) (any, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// NewDummyHugoSite creates a new minimal test site.
|
||||
func NewDummyHugoSite(cfg config.Provider) Site {
|
||||
return testSite{
|
||||
|
Reference in New Issue
Block a user