shithub: hugo

Download patch

ref: be7c1e5dd41812a59aff0194c19c901ce1e0bdc6
parent: beff6805340203434d2b8ca738194b781fd37b83
author: bep <[email protected]>
date: Sat Apr 18 16:23:14 EDT 2015

Add doc for Ace templates

Fixes #1063

--- /dev/null
+++ b/docs/content/templates/ace.md
@@ -1,0 +1,66 @@
+---
+aliases:
+- /doc/templates/ace
+- /layout/templates/ace
+- /layout/ace/
+date: 2014-04-20
+linktitle: Ace templates
+menu:
+  main:
+    parent: layout
+next: /templates/functions
+prev: /templates/go-templates
+title: Hugo Templates
+weight: 17
+---
+
+In addition to [Go templates](/templates/go-templates) and Amber[^needs-doc] templates, Hugo supports the powerful Ace templates.
+
+For template documentation, follow the links from the [Ace project](https://github.com/yosssi/ace). 
+
+* 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 noticable difference between Ace and the others is the inheritance support through [base and inner templates](https://github.com/yosssi/ace/tree/master/examples/base_inner_template).
+
+In Hugo the base template will be chosen in the following order:
+
+```
+1. <current-path>/<template-name>-baseof.ace, e.g. list-baseof.ace
+2. <current-path>/baseof.ace
+3. _default/<template-name>-baseof.ace, e.g. list-baseof.ace.
+4. _default/baseof.ace	
+```
+
+In the above, `current-path` is where the corresponding inner template lives, `list.ace`, `single.ace`, `index.ace` ...
+
+```
+.:
+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:** An Ace template without a reference to a base secion, 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).
+[^needs-doc]: Needs documentation! Contribution welcomed, see [issue 1064](https://github.com/spf13/hugo/issues/1064).
+
--- a/docs/content/templates/go-templates.md
+++ b/docs/content/templates/go-templates.md
@@ -6,7 +6,7 @@
 menu:
   main:
     parent: layout
-next: /templates/functions
+next: /templates/ace
 prev: /templates/overview
 title: Go Template Primer
 weight: 15