aboutsummaryrefslogtreecommitdiffhomepage
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/fileInfo.go9
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))