Bobtemplates barceloneta theme template-override feature

When creating a barceloneta theme project using bobtemplates it also creates the template-override folder.
I am following https://training.plone.org/5/theming/theme-package-4.html - but I know these tutorials are a bit outdated.
Anyhow, in the tutorial above, you just add the new template to override the regular one with the dot notation: plone.app.event.browser.event_view.pt or plone.app.layout.viewlets.sections.pt
My question here is is this enough? Since it did not work for me (maybe I got something wrong). But doing somemore digging I had to add a configuration in the browser/configure.zcml file:

<browser:viewlet
name="plone.global_sections"
manager="plone.app.layout.viewlets.interfaces.IMainNavigation"
class="plone.app.layout.viewlets.common.GlobalSectionsViewlet"
template="../theme/template-overrides/plone.app.layout.viewlets.sections.pt"
layer="plonetheme.theme.interfaces.IPlonethemeCodehutlabsLayer"
permission="zope2.View"
/>

Is this a good way to do it or am I missing something?

It used to be that you had to define the template overrides directory in your main configure.zcml

I have this in a Plone 5.0 site, maybe it has changed? I think I remember z3c.jbot is included in 5.2?

  <!--
       Load template overrides using z3c.jbot
  -->
  <include package="z3c.jbot" file="meta.zcml" />
  <browser:jbot directory="browser/templates/overrides"
        layer=".interfaces.IAddonSpecific"
        />

Edit/add: and in interfaces.py there should be a marker for your browserinterface.

in 5.2 it is IDefaultBrowserLayer (was IDefaultPloneLayer)

from zope.publisher.interfaces.browser import IDefaultBrowserLayer
class IThemeSpecific(IDefaultBrowserLayer):
1 Like

This CMFPlone Issue: main_template overrides with z3c.jbot no longer work in Plone 5.2 might also affect you.

Thank you Norbert. This helped.

I added browser:jbot to configure.zcml (not browser/configure.zcml).

The declaration of the override folder in manifest.cfg is a bit confusing because of that:

[theme:overrides]
directory = template-overrides

Will see how this evolves over time.

Plone Foundation Code of Conduct