Reimplement archetypes
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 13 Oct 2021 06:12:06 +0000 (08:12 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sat, 16 Oct 2021 13:22:03 +0000 (15:22 +0200)
commit9185e11effa682ea1ef7dc98f2943743671023a6
treef89d4138ddffd163a2afcd814ed2c26d3c66c4c9
parent168a3aab4622786ccd0943137fce3912707f2a46
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
19 files changed:
commands/hugo.go
commands/new.go
commands/new_site.go
create/content.go
create/content_template_handler.go [deleted file]
create/content_test.go
deps/deps.go
hugofs/glob/glob.go
hugofs/glob/glob_test.go
hugolib/content_factory.go [new file with mode: 0644]
hugolib/content_factory_test.go [new file with mode: 0644]
hugolib/filesystems/basefs.go
hugolib/hugo_sites.go
hugolib/pages_capture_test.go
hugolib/site.go
langs/i18n/translationProvider.go
source/content_directory_test.go
source/filesystem_test.go
source/sourceSpec.go