Ignore / replace baseof.html for one template

Is there any way you can tell a template not to inherit baseof.html?

Say you have your _default

  • baseof
  • list
  • single

Then section-one inherits baseof and overrides:

  • list
  • single

Then say for section-two you want the single template to be completely different, and not include anything from baseof.

  • list
  • single <- skip baseof here

I guess you could achieve this by checking whether you are on a single page in section-two in the baseof template, but wondering if its possible to achieve this from within the section template, i.e /themes/<THEME>/layouts/section-two/single.html

Have a look at the section “base template lookup order” for this.

You probably need to create baseof in the section-two folder.

Other than that, a really hacky way would be to have a baseof template with only blocks and then overwrite the blocks you don’t like in single.html. an html comment would do the trick.

That would overwrite the baseof template for everything in section two though, right? I’m talking about doing it for an individual template (within that section). So as in the example above, for pages using the single template, but not those using the list template.

Change your baseof template, use anything like

{{if (eq .Type "section-two") }}
{{ end }}

Other templates do not inherit from baseof automatically. You have to write something like this to make the inheritance happen:

{{ define "main" }}

{{ end }}

So if you omit those bits from your template, it won’t inherit from baseof.


Ha, oh yeah! That’s the answer then :grin: