mirror of
https://github.com/gohugoio/hugo.git
synced 2025-09-08 23:40:40 +02:00
Misc depreation updates
* Deprecate .Page.Path when backed by a file * site.Permalinks * --ignoreVendor (use --ignoreVendorPaths) Closes #9348 Closes #9349
This commit is contained in:
@@ -232,6 +232,24 @@ func (p *pageMeta) Params() maps.Params {
|
||||
}
|
||||
|
||||
func (p *pageMeta) Path() string {
|
||||
if !p.File().IsZero() {
|
||||
const example = `
|
||||
{{ $path := "" }}
|
||||
{{ with .File }}
|
||||
{{ $path = .Path }}
|
||||
{{ else }}
|
||||
{{ $path = .Path }}
|
||||
{{ end }}
|
||||
`
|
||||
helpers.Deprecated(".Path when the page is backed by a file", "We plan to use Path for a canonical source path and you probably want to check the source is a file. To get the current behaviour, you can use a construct simlar to the below:\n"+example, false)
|
||||
|
||||
}
|
||||
|
||||
return p.Pathc()
|
||||
}
|
||||
|
||||
// This is just a bridge method, use Path in templates.
|
||||
func (p *pageMeta) Pathc() string {
|
||||
if !p.File().IsZero() {
|
||||
return p.File().Path()
|
||||
}
|
||||
@@ -759,7 +777,7 @@ func (p *pageMeta) newContentConverter(ps *pageState, markup string, renderingCo
|
||||
converter.DocumentContext{
|
||||
Document: newPageForRenderHook(ps),
|
||||
DocumentID: id,
|
||||
DocumentName: p.Path(),
|
||||
DocumentName: p.File().Path(),
|
||||
Filename: filename,
|
||||
ConfigOverrides: renderingConfigOverrides,
|
||||
},
|
||||
|
Reference in New Issue
Block a user