diff options
author | Bjørn Erik Pedersen <[email protected]> | 2023-05-17 13:12:49 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2023-05-17 22:13:29 +0200 |
commit | 05542130ba0205d3d8d14575b7e49ed42a855b9a (patch) | |
tree | bb94df8ba48b349bdcb18d254af51a38722bef13 /resources | |
parent | 5251f015bfff40b49f92f8855834d5682f925860 (diff) | |
download | hugo-05542130ba0205d3d8d14575b7e49ed42a855b9a.tar.gz hugo-05542130ba0205d3d8d14575b7e49ed42a855b9a.zip |
Handle transient errors in config loading etc.
As in: Get the Kubernetes site to build with the new Hugo version.
Updates #10947
Diffstat (limited to 'resources')
-rw-r--r-- | resources/page/site.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/resources/page/site.go b/resources/page/site.go index d36857bb1..899042391 100644 --- a/resources/page/site.go +++ b/resources/page/site.go @@ -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{ |