summaryrefslogtreecommitdiffstats
path: root/hugolib/site.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-10-13 08:12:06 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-10-16 15:22:03 +0200
commit9185e11effa682ea1ef7dc98f2943743671023a6 (patch)
treef89d4138ddffd163a2afcd814ed2c26d3c66c4c9 /hugolib/site.go
parent168a3aab4622786ccd0943137fce3912707f2a46 (diff)
Reimplement archetypes
The old implementation had some issues, mostly related to the context (e.g. name, file paths) passed to the template. This new implementation is using the exact same code path for evaluating the pages as in a regular build. This also makes it more robust and easier to reason about in a multilingual setup. Now, if you are explicit about the target path, Hugo will now always pick the correct mount and language: ```bash hugo new content/en/posts/my-first-post.md ``` Fixes #9032 Fixes #7589 Fixes #9043 Fixes #9046 Fixes #9047
Diffstat (limited to 'hugolib/site.go')
-rw-r--r--hugolib/site.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/hugolib/site.go b/hugolib/site.go
index 18c9bfc80..96cf0b93c 100644
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -1193,7 +1193,7 @@ func (s *Site) processPartial(config *BuildCfg, init func(config *BuildCfg) erro
filenamesChanged = helpers.UniqueStringsReuse(filenamesChanged)
- if err := s.readAndProcessContent(filenamesChanged...); err != nil {
+ if err := s.readAndProcessContent(*config, filenamesChanged...); err != nil {
return err
}
@@ -1207,7 +1207,7 @@ func (s *Site) process(config BuildCfg) (err error) {
err = errors.Wrap(err, "initialize")
return
}
- if err = s.readAndProcessContent(); err != nil {
+ if err = s.readAndProcessContent(config); err != nil {
err = errors.Wrap(err, "readAndProcessContent")
return
}
@@ -1376,8 +1376,8 @@ func (s *Site) eventToIdentity(e fsnotify.Event) (identity.PathIdentity, bool) {
return identity.PathIdentity{}, false
}
-func (s *Site) readAndProcessContent(filenames ...string) error {
- sourceSpec := source.NewSourceSpec(s.PathSpec, s.BaseFs.Content.Fs)
+func (s *Site) readAndProcessContent(buildConfig BuildCfg, filenames ...string) error {
+ sourceSpec := source.NewSourceSpec(s.PathSpec, buildConfig.ContentInclusionFilter, s.BaseFs.Content.Fs)
proc := newPagesProcessor(s.h, sourceSpec)