I’ve built Hugo from git, and I have Ace templates working now, but I can’t figure out how I refer to the base template properly to make this happen. In Jinja2, this would be something like {% extends ‘base.html’ %}.
I think splitting up HTML opening and closing tags between files is one of the biggest contributing factors to the nightmare that is WordPress, and I’m desperate to find an alternative to that with Hugo.
I agree, it shouldn’t be too hard. I’ve started learning Go a bit in hopes of getting to know Hugo’s code, with the end goal of making some sort of proposal about how this might work. Anyway, hopefully we can grow interest in this approach, because I truly believe that it is the right approach to templating.
@spf13@tatsushid I’ve been looking at the code, and the Ace docs, and it seems like the implementation here will not be terribly difficult. The trouble is that Ace needs to have the base template defined on the Go side, rather than the template side. The trick here will be deciding how this extra bit of information ought to be specified.
The theme metadata file might be a nice place for it, but it seems like that could end up being either inflexible, or growing to be unwieldy. I’d love to get some sort of discussion going on this before I begin work on a pull request.
Does any progress have been made on this feature? I do templating using some PHP template engine and I feel limited every time I used Go template engine. No inheritance and very limited loop operations.
I have created a “work in progress” pull request for this. It works great, but need some polish.
Look how my site cleaned up:
The pull request:
Some notes below. I have to sleep on one or two of these. Input welcome:
On my site I have only one base template and one content section (= content main). One can have many sections (it handles the case with many sections in base and only some of them in a given template) and more than one base template.
The current rules for base template is:
It looks for baseof.ace (only Scandinavians will get that) first in current dir and then in layouts/_default.