hugo/helpers
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
..
baseURL.go helpers, output: Fix spelling 2017-03-28 01:19:46 +02:00
baseURL_test.go all: Propagate baseURL error to the callers 2017-03-27 15:43:56 +02:00
content.go Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00
content_renderer.go Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00
content_renderer_test.go helpers: Delete RenderingContext.getConfig 2017-04-22 22:40:20 +02:00
content_test.go helpers: Delete RenderingContext.getConfig 2017-04-22 22:40:20 +02:00
emoji.go helpers: Use iterate operator by int in Emojify 2016-11-23 09:13:00 +01:00
emoji_test.go Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00
general.go Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00
general_test.go tpl: Add template function namespaces 2017-04-30 10:56:38 +02:00
hugo.go releaser: Prepare repository for 0.24-DEV 2017-06-16 09:52:02 +02:00
hugo_test.go Automate the Hugo release process 2017-04-24 11:08:56 +02:00
language.go Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00
language_test.go all: Refactor to nonglobal Viper, i18n etc. 2017-02-17 17:15:26 +01:00
path.go commands, create: Add .Site to the archetype templates 2017-06-19 10:47:00 +02:00
path_test.go Run gofmt to get imports in line vs gohugoio/hugo 2017-06-13 19:12:10 +02:00
pathspec.go commands, create: Add .Site to the archetype templates 2017-06-19 10:47:00 +02:00
pathspec_test.go all: Update import paths to gohugoio/hugo 2017-06-13 18:42:45 +02:00
pygments.go all: Update import paths to gohugoio/hugo 2017-06-13 18:42:45 +02:00
pygments_test.go all: Refactor to nonglobal Viper, i18n etc. 2017-02-17 17:15:26 +01:00
testhelpers_test.go all: Update import paths to gohugoio/hugo 2017-06-13 18:42:45 +02:00
url.go output: Rename HTMLType etc. to HTMLFormat 2017-03-27 15:43:56 +02:00
url_test.go all: Update import paths to gohugoio/hugo 2017-06-13 18:42:45 +02:00