diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-03-17 11:12:33 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-05-14 13:12:08 +0200 |
commit | e2d66e3218e180bbfca06ca3a29ce01957c513e9 (patch) | |
tree | ed29bb99cf16b75b6334e2fc618d31e80203e5d5 /source/fileInfo.go | |
parent | 55dea41c1ab703f13b841389c6888815a033cf86 (diff) | |
download | hugo-e2d66e3218e180bbfca06ca3a29ce01957c513e9.tar.gz hugo-e2d66e3218e180bbfca06ca3a29ce01957c513e9.zip |
Create pages from _content.gotmpl
Closes #12427
Closes #12485
Closes #6310
Closes #5074
Diffstat (limited to 'source/fileInfo.go')
-rw-r--r-- | source/fileInfo.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/fileInfo.go b/source/fileInfo.go index 44d08e620..efe88a2c1 100644 --- a/source/fileInfo.go +++ b/source/fileInfo.go @@ -21,6 +21,7 @@ import ( "github.com/bep/gitmap" "github.com/gohugoio/hugo/common/hugo" "github.com/gohugoio/hugo/common/paths" + "github.com/gohugoio/hugo/media" "github.com/gohugoio/hugo/common/hugio" @@ -37,6 +38,12 @@ type File struct { lazyInit sync.Once } +// IsContentAdapter returns whether the file represents a content adapter. +// This means that there may be more than one Page associated with this file. +func (fi *File) IsContentAdapter() bool { + return fi.fim.Meta().PathInfo.IsContentData() +} + // Filename returns a file's absolute path and filename on disk. func (fi *File) Filename() string { return fi.fim.Meta().Filename } @@ -136,7 +143,7 @@ func (fi *File) p() *paths.Path { func NewFileInfoFrom(path, filename string) *File { meta := &hugofs.FileMeta{ Filename: filename, - PathInfo: paths.Parse("", filepath.ToSlash(path)), + PathInfo: media.DefaultPathParser.Parse("", filepath.ToSlash(path)), } return NewFileInfo(hugofs.NewFileMetaInfo(nil, meta)) |