mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
79b2725ac4
Hopefully. Fixes #2363
2 KiB
2 KiB
aliases | lastmod | date | linktitle | menu | next | prev | title | weight | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
2015-08-04 | 2014-04-20 | Ace templates |
|
/templates/functions | /templates/go-templates | Ace Templates | 17 |
In addition to Go templates and Amber templates, Hugo supports the powerful Ace templates.
For template documentation, follow the links from the Ace project.
- Ace templates must be named with the ace-suffix, e.g.
list.ace
- It's possible to use both Go templates and Ace templates side-by-side, and include one into the other
- Full Go template syntax support, including all the useful helper funcs
- Partials can be included both with the Ace and the Go template syntax:
= include partials/foo.html .
[^ace-theme]{{ partial "foo" . }}
One noticeable difference between Ace and the others is the inheritance support through base and inner templates.
In Hugo the base template will be chosen with the same ruleset as for Go templates.
.: index.ace
./blog: single.ace baseof.ace
./_default: baseof.ace list.ace single.ace single-baseof.ace
Some examples for the layout files above:
* Home page: `./index.ace` + `./_default/baseof.ace`
* Single page in the `blog` section: `./blog/single.ace` + `./blog/baseof.ace`
* Single page in another section: `./_default/single.ace` + `./_default/single-baseof.ace`
* Taxonomy page in any section: `./_default/list.ace` + `./_default/baseof.ace`
**Note:** In most cases one `baseof.ace` in `_default` will suffice.
**Note:** An Ace template without a reference to a base section, e.g. `= content`, will be handled as a standalone template.
[^ace-theme]: Note that the `html` suffix is needed, even if the filename is suffixed `ace`. This does not work from inside a theme, see [issue 763](https://github.com/spf13/hugo/issues/763).