Layouts for achetypes

Hi, working through my first real site after a couple of quick test sites - sorry if this is a noob question but I couldn’t find clarity in the docs.

The theme I’m using is Learn, which has an archetype of ‘chapters’ and ‘default’.

I want to add Disqus only to default (non chapters).

I’m guessing now, but the theme layout has just _default folder

So, I couldn’t see this in the docs, but can you create a layout _chapters with a single in that?

Or alternatively, is there a conditional that can be applied to _default/single.html for the disqus code ?

Lots of ways to do this, but just set up a conditional in your templating before calling the built-in Disqus partial and add removecomments: true to your front matter for pieces you don’t want to have comments:

{{if not .Params.removecomments}}
    {{ template "_internal/disqus.html" . }}

If chapters is a section…

{{if ne .Section "chapters"}}
    {{ template "_internal/disqus.html" . }}


Many thanks, chapters seems to be a Param

{{ if not .Params.chapter }}
    {{ template "_internal/disqus.html" . }}
{{ end }}

Works perfectly.


Cool. I think we are using “archetypes” differently, but I’m glad you figured it out nonetheless. Cheers.