hugolib: Deprecate site methods Author, Authors, and Social

Closes #12228
This commit is contained in:
Joe Mooring
2024-03-12 11:16:05 -07:00
committed by Bjørn Erik Pedersen
parent 78178d0c2a
commit d4d49e0f0e
10 changed files with 42 additions and 36 deletions

View File

@@ -52,9 +52,9 @@ type AlternativeOutputFormatsProvider interface {
// AuthorProvider provides author information.
type AuthorProvider interface {
// Deprecated.
// Deprecated: Use taxonomies instead.
Author() Author
// Deprecated.
// Deprecated: Use taxonomies instead.
Authors() AuthorList
}

View File

@@ -14,9 +14,11 @@
package page
// AuthorList is a list of all authors and their metadata.
// Deprecated: Use taxonomies instead.
type AuthorList map[string]Author
// Author contains details about the author of a page.
// Deprecated: Use taxonomies instead.
type Author struct {
GivenName string
FamilyName string
@@ -41,4 +43,5 @@ type Author struct {
// - youtube
// - linkedin
// - skype
// Deprecated: Use taxonomies instead.
type AuthorSocial map[string]string

View File

@@ -79,10 +79,12 @@ func (p *nopPage) RSSLink() template.URL {
return ""
}
// Deprecated: Use taxonomies instead.
func (p *nopPage) Author() Author {
return Author{}
}
// Deprecated: Use taxonomies instead.
func (p *nopPage) Authors() AuthorList {
return nil
}

View File

@@ -108,13 +108,13 @@ type Site interface {
// Returns the site config.
Config() SiteConfig
// Author is deprecated and will be removed in a future release.
// Deprecated: Use taxonomies instead.
Author() map[string]interface{}
// Authors is deprecated and will be removed in a future release.
// Deprecated: Use taxonomies instead.
Authors() AuthorList
// Returns the social links for this site.
// Deprecated: Use .Site.Params instead.
Social() map[string]string
// Deprecated: Use Config().Services.GoogleAnalytics instead.
@@ -165,16 +165,19 @@ func (s *siteWrapper) Key() string {
return s.s.Language().Lang
}
// // Deprecated: Use .Site.Params instead.
func (s *siteWrapper) Social() map[string]string {
return s.s.Social()
}
// Deprecated: Use taxonomies instead.
func (s *siteWrapper) Author() map[string]interface{} {
return s.s.Author()
}
// Deprecated: Use taxonomies instead.
func (s *siteWrapper) Authors() AuthorList {
return AuthorList{}
return s.s.Authors()
}
// Deprecated: Use .Site.Config.Services.GoogleAnalytics.ID instead.
@@ -321,14 +324,17 @@ type testSite struct {
l *langs.Language
}
// Deprecated: Use taxonomies instead.
func (s testSite) Author() map[string]interface{} {
return nil
}
// Deprecated: Use taxonomies instead.
func (s testSite) Authors() AuthorList {
return AuthorList{}
}
// Deprecated: Use .Site.Params instead.
func (s testSite) Social() map[string]string {
return make(map[string]string)
}

View File

@@ -127,10 +127,12 @@ func (p *testPage) AlternativeOutputFormats() OutputFormats {
panic("testpage: not implemented")
}
// Deprecated: Use taxonomies instead.
func (p *testPage) Author() Author {
return Author{}
}
// Deprecated: Use taxonomies instead.
func (p *testPage) Authors() AuthorList {
return nil
}