diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2024-03-17 11:12:33 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2024-05-14 13:12:08 +0200 |
commit | e2d66e3218e180bbfca06ca3a29ce01957c513e9 (patch) | |
tree | ed29bb99cf16b75b6334e2fc618d31e80203e5d5 /hugofs/walk.go | |
parent | 55dea41c1ab703f13b841389c6888815a033cf86 (diff) |
Create pages from _content.gotmpl
Closes #12427
Closes #12485
Closes #6310
Closes #5074
Diffstat (limited to 'hugofs/walk.go')
-rw-r--r-- | hugofs/walk.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/hugofs/walk.go b/hugofs/walk.go index 391f70a65..4af46d89e 100644 --- a/hugofs/walk.go +++ b/hugofs/walk.go @@ -23,6 +23,7 @@ import ( "github.com/gohugoio/hugo/common/herrors" "github.com/gohugoio/hugo/common/loggers" "github.com/gohugoio/hugo/common/paths" + "github.com/gohugoio/hugo/media" "github.com/spf13/afero" ) @@ -50,7 +51,8 @@ type WalkwayConfig struct { Root string // The logger to use. - Logger loggers.Logger + Logger loggers.Logger + PathParser *paths.PathParser // One or both of these may be pre-set. Info FileMetaInfo // The start info. @@ -72,6 +74,10 @@ func NewWalkway(cfg WalkwayConfig) *Walkway { panic("fs must be set") } + if cfg.PathParser == nil { + cfg.PathParser = media.DefaultPathParser + } + logger := cfg.Logger if logger == nil { logger = loggers.NewDefault() @@ -161,7 +167,7 @@ func (w *Walkway) walk(path string, info FileMetaInfo, dirEntries []FileMetaInfo dirEntries = DirEntriesToFileMetaInfos(fis) for _, fi := range dirEntries { if fi.Meta().PathInfo == nil { - fi.Meta().PathInfo = paths.Parse("", filepath.Join(pathRel, fi.Name())) + fi.Meta().PathInfo = w.cfg.PathParser.Parse("", filepath.Join(pathRel, fi.Name())) } } |