Here we will learn how to do sectional styling using a CSS hook that Plone gives us for free. This type of sectional styling is not used in our theme product, except to suppress the breadcrumbs from the home page, but we discuss it here as a prelude to the advanced topic of sectional banners that follows it.
The body
tag in CMFPlone's
main_template
has an HTML class attribute that allows you to theme different sections of the site with different styles. All you do is use the prefix of section-
and then the shortname of the item in the root folder. In main_template.pt
there is a script that generates, on the fly, a class for each section of the site. The script is called getSectionFromURL
:
<body tal:attributes="class string:${here/getSectionFromURL} template-${template/id}; dir python:test(isRTL, ‘rtl', ‘ltr')">
The rendered HTML it creates looks like:
<body class="section-news section-news-aggregator template- folder_summary_view"
dir="ltr">
<div id="visual...