CouscousPHP/Couscous — pull request #35 by mnapoli (2014-11-09 01:39:22+00:00)
Title: Big simplification of "custom variables"

Currently you can define custom variables that you can use in Twig templates. You can set those variables in:

- `couscous.yml`, in the `template:` section, for example:

```yaml
template:
title: Hello!
```
- Markdown YAML front-matter, at the root, for example:

```markdown
---
layout: home
myVar: true
---
This is my documentation.
```

I've tried to simplify and uniformize that:

- we name it "metadata" instead of "custom variables"
- there can be metadata in every files (not just Twig layouts), so that we can later add options to use metadata in Markdown for example (this is just a random example)
- the whole `couscous.yml` is loaded as metadata (and accessible in Twig), so we can write directly:

```yaml
title: Hello!
```

No need for a confusing section in the config.

In short:

- metadata can come from everywhere: from `couscous.yml`, from Markdown YAML front-matter is metadata, but also from generation steps
- metadata can be used everywhere (in generation steps, in Twig layouts, etc...)