hugo/commands
Bjørn Erik Pedersen 662e12f348 commands, create: Add .Site to the archetype templates
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
2017-06-19 10:47:00 +02:00
..
benchmark.go commands: Use paths from PathSpec for walker 2017-05-09 14:07:43 +02:00
check.go Remove ShowPlan 2016-11-23 16:35:49 +01:00
commandeer.go all: Update import paths to gohugoio/hugo 2017-06-13 18:42:45 +02:00
convert.go Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00
env.go all: Use jww instead of fmt for printing 2016-11-22 22:06:48 +01:00
gen.go Add copyright header to that source files that don’t have one. 2015-12-10 15:19:38 -07:00
genautocomplete.go commands: Make first letter of flags' usage lowercase 2017-04-26 22:23:20 +02:00
gendoc.go Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00
gendocshelper.go commands: Adjust docs path 2017-06-14 10:37:58 +02:00
genman.go Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00
hugo.go Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00
hugo_windows.go Move cobra.MousetrapHelpText to hugo_windows.go 2015-12-16 21:26:47 -07:00
import_jekyll.go Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00
import_jekyll_test.go commands: Import Octopress image tag in Jekyll importer 2017-04-22 22:35:52 +02:00
limit_darwin.go commands: Adjust rlimit to 64000 2017-06-12 20:43:19 +02:00
limit_others.go Revert "commands: Remove the rlimit tweaking on macOS" 2017-06-12 20:35:19 +02:00
list.go Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00
list_config.go all: Refactor to nonglobal Viper, i18n etc. 2017-02-17 17:15:26 +01:00
new.go commands, create: Add .Site to the archetype templates 2017-06-19 10:47:00 +02:00
new_test.go all: Update import paths to gohugoio/hugo 2017-06-13 18:42:45 +02:00
release.go Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00
server.go Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00
server_test.go all: Refactor to nonglobal Viper, i18n etc. 2017-02-17 17:15:26 +01:00
undraft.go Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00
undraft_test.go all: Update import paths to gohugoio/hugo 2017-06-13 18:42:45 +02:00
version.go Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00