Subsite Theming - Include each section class in addition to top level “section-“ class in body tag
Plone currently creates a class in the body tag called "section-" using getSectionFromURL for all top level folders in main_template.pt. However, there is a known limitation in creating subsite themes within Plone. For more information, go to:
https://weblion.psu.edu/trac/weblion/wiki/SubsiteTheming
A modification could be made to getSectionFromURL to include a class for every section folder. This implementation is currently being used with a WordPress theme called Sandbox (http://www.plaintxt.org/themes/sandbox/). This can greatly help enable the ability to create subsites within Plone using CSS. The Sandbox example can be seen here: http://www.plaintxt.org/themes/sandbox/sandbox_body/
3 comments
-
miketakahashi
commented
A possible solution (courtesy of MIke Hyde):
In the last line of getSectionFromURL.py:
Replace:
return "section-" + contentPath[0]
with:
return " ".join(["section-" + "-".join(contentPath[:d+1]) for d in range(len(contentPath))])
-
anthonygerrard
commented
We're using lineages at the moment (working great) with that the body class has
section-[subsite id]Actually isn't there scope to have two classes:
root-[id of IPloneSiteRoot next up in the hierarchy]
section-[id of folder below IPloneSiteRoot in the hierarchy]I'm just in the process of implementing a ISiteSection marker interface for our sites so that we can mark a folder at any level in the hierarchy to be a section.
-
Adminoptilude
(Admin, Plone)
commented
+1 I've done this too in past projects