]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
hugolib: Deprecate site methods Author, Authors, and Social
authorJoe Mooring <joe.mooring@veriphor.com>
Tue, 12 Mar 2024 18:16:05 +0000 (11:16 -0700)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Fri, 15 Mar 2024 16:26:45 +0000 (17:26 +0100)
Closes #12228

config/allconfig/allconfig.go
hugolib/page__meta.go
hugolib/site_new.go
resources/page/page.go
resources/page/page_author.go
resources/page/page_nop.go
resources/page/site.go
resources/page/testhelpers_test.go
tpl/tplimpl/embedded/templates/opengraph.html
tpl/tplimpl/embedded/templates/twitter_cards.html

index 590f2ba60cdf3b3aa4e02ce4afc81dc44ef852cf..3a7908d55aa7cc8f75b6f04a4c8a3d45d90f8820 100644 (file)
@@ -103,9 +103,11 @@ type Config struct {
        RootConfig
 
        // Author information.
+       // Deprecated: Use taxonomies instead.
        Author map[string]any
 
        // Social links.
+       // Deprecated: Use .Site.Params instead.
        Social map[string]string
 
        // The build configuration section contains build-related configuration options.
index 8c148923dfc7474d24849581a0e682a92676f7c0..7ab904357b7833783e397c9fff3ea0122ffffd14 100644 (file)
@@ -106,9 +106,9 @@ func (p *pageMeta) Aliases() []string {
        return p.pageConfig.Aliases
 }
 
-// Deprecated: use taxonomies.
+// Deprecated: Use taxonomies instead.
 func (p *pageMeta) Author() page.Author {
-       hugo.Deprecate(".Author", "Use taxonomies.", "v0.98.0")
+       hugo.Deprecate(".Page.Author", "Use taxonomies instead.", "v0.98.0")
        authors := p.Authors()
 
        for _, author := range authors {
@@ -117,9 +117,9 @@ func (p *pageMeta) Author() page.Author {
        return page.Author{}
 }
 
-// Deprecated: use taxonomies.
+// Deprecated: Use taxonomies instead.
 func (p *pageMeta) Authors() page.AuthorList {
-       hugo.Deprecate(".Author", "Use taxonomies.", "v0.112.0")
+       hugo.Deprecate(".Page.Authors", "Use taxonomies instead.", "v0.112.0")
        return nil
 }
 
index 21d5ace96371ea5c77bdee8b8858816d737481d8..97b46e3584e75da8760c2c458981a58f16609cb5 100644 (file)
@@ -447,15 +447,21 @@ func (s *Site) Params() maps.Params {
        return s.conf.Params
 }
 
+// Deprecated: Use taxonomies instead.
 func (s *Site) Author() map[string]any {
+       hugo.Deprecate(".Site.Author", "Use taxonomies instead.", "v0.124.0")
        return s.conf.Author
 }
 
+// Deprecated: Use taxonomies instead.
 func (s *Site) Authors() page.AuthorList {
+       hugo.Deprecate(".Site.Authors", "Use taxonomies instead.", "v0.124.0")
        return page.AuthorList{}
 }
 
+// Deprecated: Use .Site.Params instead.
 func (s *Site) Social() map[string]string {
+       hugo.Deprecate(".Site.Social", "Use .Site.Params instead.", "v0.124.0")
        return s.conf.Social
 }
 
index 56ba04d74a28ff8339c3df9185ae0f73ed156794..f995ee64142faffc81142ed19c40b7adf8e4d54f 100644 (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
 }
 
index 58be204267bde820b6cb989176134a15d4296e0c..2b3282b1eb792982429a90bd4d85db220c99f46a 100644 (file)
 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
index a8f42e4d37dcb017ce785f31cc4aeb87e496ac46..d3813337dc0a45acef8cd43db3c9cc02076ad6b0 100644 (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
 }
index 8f268091ff35c5e5c8f521cb357a11d6d6fe19b9..df33485eb1a835af4eb35ad1be5fa1db4c57247c 100644 (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)
 }
index e80ed422db3f516e241a097745c1e77406bbc6a2..cedbc74e960791cc4aa4e5cd08acb8537d2a4623 100644 (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
 }
index f3f41121cfd46c1fdf9c0fa6b8823abe2b6d41ea..bbe4e5dd0b59331264a5187ab3e64c9d36121037 100644 (file)
 {{ end }}{{ end }}
 {{- end }}
 
-{{- /* Deprecate site.Social.facebook_admin in favor of site.Params.social.facebook_admin */}}
-{{- $facebookAdmin := "" }}
+{{- /* Facebook Page Admin ID for Domain Insights */}}
 {{- with site.Params.social }}
   {{- if reflect.IsMap . }}
-    {{- $facebookAdmin = .facebook_admin }}
-  {{- end }}
-{{- else }}
-  {{- with site.Social.facebook_admin }}
-    {{- $facebookAdmin = . }}
-    {{- warnf "The social key in site configuration is deprecated. Use params.social.facebook_admin instead." }}
+    {{- with .facebook_admin }}
+      <meta property="fb:admins" content="{{ . }}" />
+    {{- end }}
   {{- end }}
 {{- end }}
-
-{{- /* Facebook Page Admin ID for Domain Insights */}}
-{{ with $facebookAdmin }}<meta property="fb:admins" content="{{ . }}" />{{ end }}
index e66a5029abd890ce1bfb7dc1c29d54bd33ff03c3..c445efdfc2c008c4ed3406eaf89223fbb10a04cf 100644 (file)
@@ -8,23 +8,15 @@
 <meta name="twitter:title" content="{{ .Title }}"/>
 <meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/>
 
-{{- /* Deprecate site.Social.twitter in favor of site.Params.social.twitter */}}
 {{- $twitterSite := "" }}
 {{- with site.Params.social }}
   {{- if reflect.IsMap . }}
-    {{- $twitterSite = .twitter }}
+    {{- with .twitter }}
+      {{- $content := . }}
+      {{- if not (strings.HasPrefix . "@") }}
+        {{- $content = printf "@%v" . }}
+      {{- end }}
+      <meta name="twitter:site" content="{{ $content }}"/>
+    {{- end }}
   {{- end }}
-{{- else }}
-  {{- with site.Social.twitter }}
-    {{- $twitterSite = . }}
-    {{- warnf "The social key in site configuration is deprecated. Use params.social.twitter instead." }}
-  {{- end }}
-{{- end }}
-
-{{- with $twitterSite }}
-  {{- $content := . }}
-  {{- if not (strings.HasPrefix . "@") }}
-    {{- $content = printf "@%v" $twitterSite }}
-  {{- end }}
-<meta name="twitter:site" content="{{ $content }}"/>
 {{- end }}