Plone should…

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/

43 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    miketakahashimiketakahashi shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    3 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • miketakahashimiketakahashi commented  ·   ·  Flag as inappropriate

        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))])

      • anthonygerrardanthonygerrard commented  ·   ·  Flag as inappropriate

        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.

      Feedback and Knowledge Base