Theme parameters and variables in Plone 5 themes

Working with a Plone 5 theme I've added a [theme:parameters] section to my manifest.cfg file and defined portal_url as follows:

portal_url = portal_state/portal_url

then I add a diazo rule like this:

<before css:theme-children="body"
         <a href="{$portal_url}/specialthing">special thing</a>

This works beautifully on Plone 4, but it seems I'm missing something on Plone 5.

This approach is also documented here:

It looks like I needed to deactivate and activate the theme again before it would reread the manifest.cfg. So now the theme works and gets the portal_url as defined in the manifest.cfg

We have a similar bug on one of our customers, just with that site we need to deactivate / activate to look the changes on rules.xml, with the others sites it reads rules.xml on the fly without need to do this.

I didn't had time to figure out what happened, but I'll look forward to undestand with this thread.

@rodfersou having to reload in production is expected behavior.

It is expensive to have to compile a theme so Plone caches themes in production. Only in dev mode does it not need reloading.

Good news in Plone 5 there is a handy reload button for themes so you don't have to deactivate/activate anymore.

If you're talking about the "clear cache"
That wasn't enough to trigger re-reading of the manifest.cfg file for me.

@pigeonflight the clear cache button is on top of having to activate/deactivate themes when they're in production. The caching can make it appear as if your change (even with deactivating and reactivating a theme) hasn't take effect.

My scenario was as follows. I installed the theme, then added a new variable to the manifest.cfg. Then I cleared the cache with the "clear cache" button. But this was not enough for the system to reread the manifest.cfg and detect/register the new variable. I know this because a rule that relied on the variable did not work.

Once I deactivated and reactivated the theme the new variable then worked and was available to my diazo rule.

update... just re-reading what you said above, I now understand that you were explaining that the clear cache doesn't necessarily have the same effect as an activate/deactivate.

1 Like