aboutsummaryrefslogtreecommitdiffhomepage
path: root/resources
diff options
context:
space:
mode:
authorJoe Mooring <[email protected]>2024-03-09 11:21:46 -0800
committerBjørn Erik Pedersen <[email protected]>2024-03-10 10:47:51 +0200
commit4f92f949eaf8c9827a758b3caadc672e0335480b (patch)
treeb3e43a708cc4703697c4108d7c1798345874da8f /resources
parentd24ffdde5b34cb848d04db7099f9bf8903099209 (diff)
downloadhugo-4f92f949eaf8c9827a758b3caadc672e0335480b.tar.gz
hugo-4f92f949eaf8c9827a758b3caadc672e0335480b.zip
hugolib: Deprecate .Site.MultiLingual in favor of hugo.IsMultiLingual
Closes #12224
Diffstat (limited to 'resources')
-rw-r--r--resources/page/page_matcher_test.go13
-rw-r--r--resources/page/site.go30
2 files changed, 25 insertions, 18 deletions
diff --git a/resources/page/page_matcher_test.go b/resources/page/page_matcher_test.go
index 21f6891d7..3ab68e8af 100644
--- a/resources/page/page_matcher_test.go
+++ b/resources/page/page_matcher_test.go
@@ -157,10 +157,11 @@ func TestDecodeCascadeConfig(t *testing.T) {
}
type testConfig struct {
- environment string
- running bool
- workingDir string
- multihost bool
+ environment string
+ running bool
+ workingDir string
+ multihost bool
+ multilingual bool
}
func (c testConfig) Environment() string {
@@ -179,6 +180,10 @@ func (c testConfig) IsMultihost() bool {
return c.multihost
}
+func (c testConfig) IsMultiLingual() bool {
+ return c.multilingual
+}
+
func TestIsGlobWithExtension(t *testing.T) {
c := qt.New(t)
diff --git a/resources/page/site.go b/resources/page/site.go
index 132ab9fe8..d9f3d967b 100644
--- a/resources/page/site.go
+++ b/resources/page/site.go
@@ -54,8 +54,7 @@ type Site interface {
// A shortcut to the home
Home() Page
- // Returns true if we're running in a server.
- // Deprecated: use hugo.IsServer instead
+ // Deprecated: Use hugo.IsServer instead.
IsServer() bool
// Returns the server port.
@@ -64,7 +63,6 @@ type Site interface {
// Returns the configured title for this Site.
Title() string
- // Returns the configured language code for this Site.
// Deprecated: Use .Language.LanguageCode instead.
LanguageCode() string
@@ -86,7 +84,6 @@ type Site interface {
// Returns a taxonomy map.
Taxonomies() TaxonomyList
- // Returns the last modification date of the content.
// Deprecated: Use .Lastmod instead.
LastChange() time.Time
@@ -129,13 +126,13 @@ type Site interface {
// BuildDrafts is deprecated and will be removed in a future release.
BuildDrafts() bool
- // IsMultiLingual reports whether this site is configured with more than one language.
+ // Deprecated: Use hugo.IsMultiLingual instead.
IsMultiLingual() bool
// LanguagePrefix returns the language prefix for this site.
LanguagePrefix() string
- // Deprecated. Use site.Home.OutputFormats.Get "rss" instead.
+ // Deprecated: Use .Site.Home.OutputFormats.Get "rss" instead.
RSSLink() template.URL
}
@@ -180,7 +177,7 @@ func (s *siteWrapper) Authors() AuthorList {
return AuthorList{}
}
-// Deprecated: Use .Site.Config.Services.GoogleAnalytics.ID instead
+// Deprecated: Use .Site.Config.Services.GoogleAnalytics.ID instead.
func (s *siteWrapper) GoogleAnalytics() string {
return s.s.GoogleAnalytics()
}
@@ -217,7 +214,7 @@ func (s *siteWrapper) Home() Page {
return s.s.Home()
}
-// Deprecated: use hugo.IsServer instead
+// Deprecated: Use hugo.IsServer instead.
func (s *siteWrapper) IsServer() bool {
return s.s.IsServer()
}
@@ -262,9 +259,9 @@ func (s *siteWrapper) Taxonomies() TaxonomyList {
return s.s.Taxonomies()
}
+// Deprecated: Use .Site.Lastmod instead.
func (s *siteWrapper) LastChange() time.Time {
- hugo.Deprecate(".Site.LastChange", "Use .Site.Lastmod instead.", "v0.123.0")
- return s.s.Lastmod()
+ return s.s.LastChange()
}
func (s *siteWrapper) Lastmod() time.Time {
@@ -295,11 +292,12 @@ func (s *siteWrapper) BuildDrafts() bool {
return s.s.BuildDrafts()
}
+// Deprecated: Use hugo.IsMultiLingual instead.
func (s *siteWrapper) IsMultiLingual() bool {
return s.s.IsMultiLingual()
}
-// Deprecated: Use .Site.Config.Services.Disqus.Shortname instead
+// Deprecated: Use .Site.Config.Services.Disqus.Shortname instead.
func (s *siteWrapper) DisqusShortname() string {
return s.s.DisqusShortname()
}
@@ -308,6 +306,7 @@ func (s *siteWrapper) LanguagePrefix() string {
return s.s.LanguagePrefix()
}
+// Deprecated: Use .Site.Home.OutputFormats.Get "rss" instead.
func (s *siteWrapper) RSSLink() template.URL {
return s.s.RSSLink()
}
@@ -342,6 +341,7 @@ func (t testSite) ServerPort() int {
return 1313
}
+// Deprecated: Use .Site.Lastmod instead.
func (testSite) LastChange() (t time.Time) {
return
}
@@ -386,7 +386,7 @@ func (t testSite) Languages() langs.Languages {
return nil
}
-// Deprecated: Use .Site.Config.Services.GoogleAnalytics.ID instead
+// Deprecated: Use .Site.Config.Services.GoogleAnalytics.ID instead.
func (t testSite) GoogleAnalytics() string {
return ""
}
@@ -395,7 +395,7 @@ func (t testSite) MainSections() []string {
return nil
}
-// Deprecated: use hugo.IsServer instead
+// Deprecated: Use hugo.IsServer instead.
func (t testSite) IsServer() bool {
return false
}
@@ -444,7 +444,7 @@ func (s testSite) Config() SiteConfig {
return SiteConfig{}
}
-// Deprecated: Use .Site.Config.Services.Disqus.Shortname instead
+// Deprecated: Use .Site.Config.Services.Disqus.Shortname instead.
func (testSite) DisqusShortname() string {
return ""
}
@@ -453,6 +453,7 @@ func (s testSite) BuildDrafts() bool {
return false
}
+// Deprecated: Use hugo.IsMultiLingual instead.
func (s testSite) IsMultiLingual() bool {
return false
}
@@ -461,6 +462,7 @@ func (s testSite) Param(key any) (any, error) {
return nil, nil
}
+// Deprecated: Use .Site.Home.OutputFormats.Get "rss" instead.
func (s testSite) RSSLink() template.URL {
return ""
}