Deprecate site.Language.Params and some other fixes

Updates #10947
This commit is contained in:
Bjørn Erik Pedersen
2023-05-17 09:59:57 +02:00
parent 0106cf1a6d
commit 5d857165fe
5 changed files with 121 additions and 5 deletions

View File

@@ -37,6 +37,9 @@ type Site interface {
GetPage(ref ...string) (Page, error)
// AllPages returns all pages for all languages.
AllPages() Pages
// Returns all the regular Pages in this Site.
RegularPages() Pages
@@ -104,6 +107,9 @@ type Site interface {
// Author is deprecated and will be removed in a future release.
Author() map[string]interface{}
// Authors is deprecated and will be removed in a future release.
Authors() AuthorList
// Returns the social links for this site.
Social() map[string]string
@@ -115,6 +121,12 @@ type Site interface {
// For internal use only.
GetPageWithTemplateInfo(info tpl.Info, ref ...string) (Page, error)
// BuildDraft is deprecated and will be removed in a future release.
BuildDrafts() bool
// IsMultilingual reports whether this site is configured with more than one language.
IsMultiLingual() bool
}
// Sites represents an ordered list of sites (languages).
@@ -146,6 +158,9 @@ func (s *siteWrapper) Social() map[string]string {
func (s *siteWrapper) Author() map[string]interface{} {
return s.s.Author()
}
func (s *siteWrapper) Authors() AuthorList {
return AuthorList{}
}
func (s *siteWrapper) GoogleAnalytics() string {
return s.s.GoogleAnalytics()
@@ -159,6 +174,10 @@ func (s *siteWrapper) Language() *langs.Language {
return s.s.Language()
}
func (s *siteWrapper) AllPages() Pages {
return s.s.AllPages()
}
func (s *siteWrapper) RegularPages() Pages {
return s.s.RegularPages()
}
@@ -247,6 +266,14 @@ func (s *siteWrapper) GetPageWithTemplateInfo(info tpl.Info, ref ...string) (Pag
return s.s.GetPageWithTemplateInfo(info, ref...)
}
func (s *siteWrapper) BuildDrafts() bool {
return s.s.BuildDrafts()
}
func (s *siteWrapper) IsMultiLingual() bool {
return s.s.IsMultiLingual()
}
func (s *siteWrapper) DisqusShortname() string {
return s.s.DisqusShortname()
}
@@ -259,6 +286,9 @@ type testSite struct {
func (s testSite) Author() map[string]interface{} {
return nil
}
func (s testSite) Authors() AuthorList {
return AuthorList{}
}
func (s testSite) Social() map[string]string {
return make(map[string]string)
@@ -332,6 +362,10 @@ func (t testSite) Pages() Pages {
return nil
}
func (t testSite) AllPages() Pages {
return nil
}
func (t testSite) RegularPages() Pages {
return nil
}
@@ -368,6 +402,14 @@ func (testSite) DisqusShortname() string {
return ""
}
func (s testSite) BuildDrafts() bool {
return false
}
func (s testSite) IsMultiLingual() bool {
return false
}
// NewDummyHugoSite creates a new minimal test site.
func NewDummyHugoSite(cfg config.Provider) Site {
return testSite{