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:
Bjørn Erik Pedersen
2022-01-04 13:07:10 +01:00
parent 56ab83a597
commit 2b6063c3e3
19 changed files with 52 additions and 58 deletions

View File

@@ -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,
},