mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
662e12f348
This commit completes the "The Revival of the Archetypes!" If `.Site` is used in the arcetype template, the site is built and added to the template context. Note that this may be potentially time consuming for big sites. A more complete example would then be for the section `newsletter` and the archetype file `archetypes/newsletter.md`: ``` --- title: "{{ replace .TranslationBaseName "-" " " | title }}" date: {{ .Date }} tags: - x categories: - x draft: true --- <!--more--> {{ range first 10 ( where .Site.RegularPages "Type" "cool" ) }} * {{ .Title }} {{ end }} ``` And then create a new post with: ```bash hugo new newsletter/the-latest-cool.stuff.md ``` **Hot Tip:** If you set the `newContentEditor` configuration variable to an editor on your `PATH`, the newly created article will be opened. The above _newsletter type archetype_ illustrates the possibilities: The full Hugo `.Site` and all of Hugo's template funcs can be used in the archetype file. Fixes #1629 |
||
---|---|---|
.. | ||
baseURL.go | ||
baseURL_test.go | ||
content.go | ||
content_renderer.go | ||
content_renderer_test.go | ||
content_test.go | ||
emoji.go | ||
emoji_test.go | ||
general.go | ||
general_test.go | ||
hugo.go | ||
hugo_test.go | ||
language.go | ||
language_test.go | ||
path.go | ||
path_test.go | ||
pathspec.go | ||
pathspec_test.go | ||
pygments.go | ||
pygments_test.go | ||
testhelpers_test.go | ||
url.go | ||
url_test.go |