summaryrefslogtreecommitdiffstats
path: root/resources
diff options
context:
space:
mode:
Diffstat (limited to 'resources')
-rw-r--r--resources/page/site.go22
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{