mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-28 22:19:59 +02:00
Create pages from _content.gotmpl
Closes #12427 Closes #12485 Closes #6310 Closes #5074
This commit is contained in:
@@ -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()))
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user