ACE templates

I have fooled around with the new ACE template support (good job, @tatsushid) – and I like it, but …

In my head I had envisioned a more decorative approach to templates, with one or two base templates and a set of content/inner templates. Instead I still end up with the partial head and footer dance.

I see this:

But I cannot wrap my head around to Hugo on this.

I’m tempted to make cabaret do something like this—I think that I’m really close to what’s possible, but I also miss the ability to yield like I can with most Ruby templating languages. (Basically, if you’re willing to give up the idea that partial/head.html has the <head> tags, you can get ~90% there with includes and {{ .Render… }}.

If you get really, really close – please share.

Nice to see that you named your theme after a Norwegian food dish:

So, I thought I might show what the index.html would look like in the format that I was talking about, @bjornerik. Rather than having layouts/partials/head.html containing the doctype and other head-type stuff. If you look at the current HEAD of cabaret, I’ve made changes to make this happen. It feels a bit better—although I originally had layouts/partial/head.html contain the {{ partial "doctype" . }} and <head>…</head>. I may switch back to that, because it’s still clean regardless.

{{ partial "doctype" . }}
<head>
  {{ partial "head" . }}
</head>
<body>
  <div id="layout" class="pure-g">
    {{ partial "sidebar" . }}

    <div id="top" class="content pure-u-1 pure-u-md-3-4">
      {{ partial "list/top" . }}

      <div class="posts">
        {{ if .Site.Params.filter }}
          {{ partial "list/filtered" . }}
        {{ else }}
          {{ range .Site.Recent }}
          {{ .Render "post/summary" }}
          {{ end }}
        {{ end }}
      </div>

      {{ partial "footer" . }}
    </div>
  </div>
  {{ partial "bodyend" . }}
</body>
</html>
1 Like

Here is my first stab at porting the main templates to ACE. As I said, I wish it was cleaner – but for a small site like mine it really doesn’t matter:

https://github.com/bjornerik/bepsays.com/commit/e8a42ae0795f618cba60d4e338bd24cce1c6797e