summaryrefslogtreecommitdiffstats
path: root/resources/page/site.go
diff options
context:
space:
mode:
Diffstat (limited to 'resources/page/site.go')
-rw-r--r--resources/page/site.go50
1 files changed, 25 insertions, 25 deletions
diff --git a/resources/page/site.go b/resources/page/site.go
index 0480ce674..9ef76505d 100644
--- a/resources/page/site.go
+++ b/resources/page/site.go
@@ -21,7 +21,6 @@ import (
"github.com/gohugoio/hugo/config/privacy"
"github.com/gohugoio/hugo/config/services"
"github.com/gohugoio/hugo/identity"
- "github.com/gohugoio/hugo/tpl"
"github.com/gohugoio/hugo/config"
@@ -88,8 +87,12 @@ type Site interface {
Taxonomies() TaxonomyList
// Returns the last modification date of the content.
+ // Deprecated: Use .Lastmod instead.
LastChange() time.Time
+ // Returns the last modification date of the content.
+ Lastmod() time.Time
+
// Returns the Menus for this site.
Menus() navigation.Menus
@@ -108,10 +111,6 @@ type Site interface {
// Returns the site config.
Config() SiteConfig
- // Returns the identity of this site.
- // This is for internal use only.
- GetIdentity() identity.Identity
-
// Author is deprecated and will be removed in a future release.
Author() map[string]interface{}
@@ -127,9 +126,6 @@ type Site interface {
// Deprecated: Use Config().Privacy.Disqus instead.
DisqusShortname() string
- // For internal use only.
- GetPageWithTemplateInfo(info tpl.Info, ref ...string) (Page, error)
-
// BuildDrafts is deprecated and will be removed in a future release.
BuildDrafts() bool
@@ -154,6 +150,9 @@ func (s Sites) First() Site {
return s[0]
}
+// Some additional interfaces implemented by siteWrapper that's not on Site.
+var _ identity.ForEeachIdentityByNameProvider = (*siteWrapper)(nil)
+
type siteWrapper struct {
s Site
}
@@ -165,6 +164,10 @@ func WrapSite(s Site) Site {
return &siteWrapper{s: s}
}
+func (s *siteWrapper) Key() string {
+ return s.s.Language().Lang
+}
+
func (s *siteWrapper) Social() map[string]string {
return s.s.Social()
}
@@ -260,7 +263,11 @@ func (s *siteWrapper) Taxonomies() TaxonomyList {
}
func (s *siteWrapper) LastChange() time.Time {
- return s.s.LastChange()
+ return s.s.Lastmod()
+}
+
+func (s *siteWrapper) Lastmod() time.Time {
+ return s.s.Lastmod()
}
func (s *siteWrapper) Menus() navigation.Menus {
@@ -283,14 +290,6 @@ func (s *siteWrapper) Data() map[string]any {
return s.s.Data()
}
-func (s *siteWrapper) GetIdentity() identity.Identity {
- return s.s.GetIdentity()
-}
-
-func (s *siteWrapper) GetPageWithTemplateInfo(info tpl.Info, ref ...string) (Page, error) {
- return s.s.GetPageWithTemplateInfo(info, ref...)
-}
-
func (s *siteWrapper) BuildDrafts() bool {
return s.s.BuildDrafts()
}
@@ -312,6 +311,11 @@ func (s *siteWrapper) RSSLink() template.URL {
return s.s.RSSLink()
}
+// For internal use only.
+func (s *siteWrapper) ForEeachIdentityByName(name string, f func(identity.Identity) bool) {
+ s.s.(identity.ForEeachIdentityByNameProvider).ForEeachIdentityByName(name, f)
+}
+
type testSite struct {
h hugo.HugoInfo
l *langs.Language
@@ -341,6 +345,10 @@ func (testSite) LastChange() (t time.Time) {
return
}
+func (testSite) Lastmod() (t time.Time) {
+ return
+}
+
func (t testSite) Title() string {
return "foo"
}
@@ -386,10 +394,6 @@ func (t testSite) MainSections() []string {
return nil
}
-func (t testSite) GetIdentity() identity.Identity {
- return identity.KeyValueIdentity{Key: "site", Value: t.l.Lang}
-}
-
// Deprecated: use hugo.IsServer instead
func (t testSite) IsServer() bool {
return false
@@ -439,10 +443,6 @@ func (s testSite) Config() SiteConfig {
return SiteConfig{}
}
-func (testSite) GetPageWithTemplateInfo(info tpl.Info, ref ...string) (Page, error) {
- return nil, nil
-}
-
// Deprecated: Use .Site.Config.Services.Disqus.Shortname instead
func (testSite) DisqusShortname() string {
return ""