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
check.go
commandeer.go
convert.go Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00
env.go
gen.go
genautocomplete.go
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
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
limit_darwin.go
limit_others.go
list.go Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00
list_config.go
new.go commands, create: Add .Site to the archetype templates 2017-06-19 10:47:00 +02:00
new_test.go
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
undraft.go Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00
undraft_test.go
version.go Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00