Documentation on using Ace Templates [Solved]

Just this weekend, I was contemplating using the Jade templating system to compose Hugo’s theme layouts. I just miss the inheritance and decoration feature too much.

Then I saw just a few hours ago that the newest version now support the Ace templating system.

It seems to be inspired by Jade so I am willing to give it a shot. I tried porting some of my theme’s layout but I quickly ran into problems.

I can’t seem to find anything about Ace templates in the documentation. Is the documentation on using Ace templates still in WIP?

I use Ace templates on my site, and there is one piece missing in the integration in Hugo, and that is the base inheritance feature. Do a search for Ace here in the forum.

I see. That explains why I did not see problems when converting my base template file but had a lot of problems with the partials.

There is this issue:

And this discussion:

My templates are very simple. My biggest problem is that I can’t seem to use include on partials.

I have a footer.acefile.

<footer>
  &copy; 2015 All Rights Reserved.
</footer>

When I include it in my base html

= include partials/footer.html .

What i get is mangled markup

<><©>2015 All Rights Reserved.</©></><

If I use this

= include partials/footer.ace .

I get a blank output and this error

ERROR: 2015/02/28 Unable to render [partials/footer.ace theme/partials/footer.ace]
ERROR: 2015/02/28 Expecting to find a template in either the theme/layouts or /layouts in one of the following relative locations [partials/footer.ace theme/partials/footer.ace]

Maybe I am not understanding this correctly?

If your layout files is in a theme, this can be it:

1 Like

I see. It is a bug then. Both of the code snippets below output mangled markup.

{{ partial "footer" . }}
= include theme/partials/footer.html . 

No, the first one works fine in all cases.

The second one works fine, unless in a theme.

Ugh!

Yes, you are right. I got the mangled markup in the first case because I used HTML markup, not ACE.

Thanks for the help! Now I can convert my templates to ACE :slight_smile: