Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-01-04 15:07:10 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-01-04 19:10:39 +0300
commit2b6063c3e388056597af88709ff017d15f53c962 (patch)
treea86d4dde3cd5b7df5bb5738a248a0da0c5f640fd /resources
parent56ab83a59712725e1ce0dd3fd516cc7c190c8478 (diff)
Misc depreation updates
* Deprecate .Page.Path when backed by a file * site.Permalinks * --ignoreVendor (use --ignoreVendorPaths) Closes #9348 Closes #9349
Diffstat (limited to 'resources')
-rw-r--r--resources/page/page.go6
-rw-r--r--resources/page/page_marshaljson.autogen.go7
-rw-r--r--resources/page/page_matcher.go3
-rw-r--r--resources/page/page_nop.go4
-rw-r--r--resources/page/testhelpers_test.go4
5 files changed, 17 insertions, 7 deletions
diff --git a/resources/page/page.go b/resources/page/page.go
index 0b402c4e7..f23069a68 100644
--- a/resources/page/page.go
+++ b/resources/page/page.go
@@ -180,6 +180,9 @@ type PageMetaProvider interface {
// to the source of this Page. It will be relative to any content root.
Path() string
+ // This is just a temporary bridge method. Use Path in templates.
+ Pathc() string
+
// The slug, typically defined in front matter.
Slug() string
@@ -392,5 +395,4 @@ type DeprecatedWarningPageMethods1 interface {
// Move here to trigger ERROR instead of WARNING.
// TODO(bep) create wrappers and put into the Page once it has some methods.
-type DeprecatedErrorPageMethods interface {
-}
+type DeprecatedErrorPageMethods interface{}
diff --git a/resources/page/page_marshaljson.autogen.go b/resources/page/page_marshaljson.autogen.go
index 2286f1e63..6cfa411e2 100644
--- a/resources/page/page_marshaljson.autogen.go
+++ b/resources/page/page_marshaljson.autogen.go
@@ -17,6 +17,9 @@ package page
import (
"encoding/json"
+ "html/template"
+ "time"
+
"github.com/bep/gitmap"
"github.com/gohugoio/hugo/common/maps"
"github.com/gohugoio/hugo/config"
@@ -26,8 +29,6 @@ import (
"github.com/gohugoio/hugo/media"
"github.com/gohugoio/hugo/navigation"
"github.com/gohugoio/hugo/source"
- "html/template"
- "time"
)
func MarshalPageToJSON(p Page) ([]byte, error) {
@@ -68,7 +69,7 @@ func MarshalPageToJSON(p Page) ([]byte, error) {
linkTitle := p.LinkTitle()
isNode := p.IsNode()
isPage := p.IsPage()
- path := p.Path()
+ path := p.Pathc()
slug := p.Slug()
lang := p.Lang()
isSection := p.IsSection()
diff --git a/resources/page/page_matcher.go b/resources/page/page_matcher.go
index 8e81f810d..0c4c2d0e2 100644
--- a/resources/page/page_matcher.go
+++ b/resources/page/page_matcher.go
@@ -59,7 +59,7 @@ func (m PageMatcher) Matches(p Page) bool {
if m.Path != "" {
g, err := glob.GetGlob(m.Path)
// TODO(bep) Path() vs filepath vs leading slash.
- p := strings.ToLower(filepath.ToSlash(p.Path()))
+ p := strings.ToLower(filepath.ToSlash(p.Pathc()))
if !(strings.HasPrefix(p, "/")) {
p = "/" + p
}
@@ -104,7 +104,6 @@ func DecodeCascade(in interface{}) (map[PageMatcher]maps.Params, error) {
}
return cascade, nil
-
}
// DecodePageMatcher decodes m into v.
diff --git a/resources/page/page_nop.go b/resources/page/page_nop.go
index 4f91883a0..011fabfc0 100644
--- a/resources/page/page_nop.go
+++ b/resources/page/page_nop.go
@@ -338,6 +338,10 @@ func (p *nopPage) Path() string {
return ""
}
+func (p *nopPage) Pathc() string {
+ return ""
+}
+
func (p *nopPage) Permalink() string {
return ""
}
diff --git a/resources/page/testhelpers_test.go b/resources/page/testhelpers_test.go
index a21ab2ff3..57077ecf8 100644
--- a/resources/page/testhelpers_test.go
+++ b/resources/page/testhelpers_test.go
@@ -414,6 +414,10 @@ func (p *testPage) Path() string {
return p.path
}
+func (p *testPage) Pathc() string {
+ return p.path
+}
+
func (p *testPage) Permalink() string {
panic("not implemented")
}