github.com/rabbouni145/gg@v0.47.1/docs/content/en/templates/alternatives.md (about)

     1  ---
     2  title: Alternative Templating Languages
     3  linktitle: Alternative Templating
     4  description: In addition to Go templates, Hugo supports the powerful Ace templating from @yosssi and Amber templating from @eknkc.
     5  godocref:
     6  date: 2017-02-01
     7  publishdate: 2017-02-01
     8  lastmod: 2017-02-20
     9  categories: [templates]
    10  keywords: [amber,ace,templating languages]
    11  menu:
    12    docs:
    13      parent: "templates"
    14      weight: 170
    15  weight: 170
    16  sections_weight: 170
    17  draft: false
    18  aliases: [/templates/ace/,/templates/amber/]
    19  toc: true
    20  ---
    21  
    22  ## Ace Templates
    23  
    24  For template documentation, follow the links from the [Ace project](https://github.com/yosssi/ace).
    25  
    26  * Ace templates must be named with the ace-suffix; e.g., `list.ace`
    27  * It's possible to use both Go templates and Ace templates side by side and even include one into the other
    28  * Full Go template syntax support, including all the useful helper [template functions][]
    29  * Partials can be included both with the Ace and the Go template syntax. For example, the following two will have the same output in Ace:
    30      * `= include partials/foo.html .`
    31      * `{{ partial "foo" . }}`
    32  
    33  One noticeable difference between Ace and the other templating engines in Hugo is [Ace's inheritance support through base and inner templates][aceinheritance].
    34  
    35  In Hugo, the Ace base template will be chosen with the same rule set as for [Go base templates][].
    36  
    37  ```
    38  .:
    39  index.ace
    40  
    41  ./blog:
    42  single.ace
    43  baseof.ace
    44  
    45  ./_default:
    46  baseof.ace  list.ace  single.ace  single-baseof.ace
    47  ```
    48  
    49  {{% note %}}
    50  Note that the `html` suffix is needed even if the filename is suffixed `ace`. This does not work from inside a theme ([issue #763](https://github.com/gohugoio/hugo/issues/763)).
    51  {{% /note %}}
    52  
    53  Some examples for the layout files above:
    54  
    55  * Home page: `./index.ace` +  `./_default/baseof.ace`
    56  * Single page in the `blog` section: `./blog/single.ace` +  `./blog/baseof.ace`
    57  * Single page in another section: `./_default/single.ace` +  `./_default/single-baseof.ace`
    58  * Taxonomy page in any section: `./_default/list.ace` +  `./_default/baseof.ace`
    59  
    60  {{% note %}}
    61  In most cases, one `baseof.ace` in `_default` will suffice. An Ace template without a reference to a base section (e.g., `= content`) will be handled as a standalone template.
    62  {{% /note %}}
    63  
    64  ## Amber Templates
    65  
    66  For Amber template documentation, follow the links from the [Amber project][].
    67  
    68  * Amber templates must be named with the Amber suffix; e.g., `list.amber`
    69  * Partials in Amber or HTML can be included with the Amber template syntax:
    70      * `import ../partials/test.html `
    71      * `import ../partials/test_a.amber `
    72  
    73  [aceinheritance]: https://github.com/yosssi/ace/tree/master/examples/base_inner_template
    74  [Amber Project]: https://github.com/eknkc/amber
    75  [template functions]: /functions/
    76  [Go templates]: /templates/introduction/
    77  [Go base templates]: /templates/base/