Thanks for the ideas. I think djangocms-page-tags or a page extension is
the right approach, but for now, I've got:
<body data-cms-path="{{ request.current_page.get_path }}">
which renders the attribute value as "section-1/subsection-1/page-1". So,
in my CSS, I can use:
[data-cms-path*="subsection-1"] {
}
to style section elements. Of course, this will break of the slugs change,
or if they're different in Spanish, or if a section page exists outside of
the tree. But it works for now.
On Friday, November 18, 2016 at 4:10:51 AM UTC-5, Daniele Procida wrote:
>
> On Thu, Nov 17, 2016, Brian Rutledge <[email protected] <javascript:>>
> wrote:
>
> >In our templates, I'd like to be able to identify a page as being part of
> a
> >section of the site, so that we can apply section-specific CSS. My
> initial
> >thought on how to do this would be to add a class to the <body> tag, but
> I
> >don't see an attribute on the Page model for this. What do y'all think of
> >adding that? Is there another way to accomplish this in the django CMS
> >ecosystem? I'd rather not define a new template for each section.
>
> I've done this with another application. It maintained a tree representing
> the structure of an institution, and each node of that tree could be
> attached to a page. So each page, and all of its descendants, knew they
> belonged to such-and-such department or office or body.
>
> The application did a lot more besides. It might be overkill if
> identifying a page is all you need.
>
> Daniele
>
>
--
Message URL:
https://groups.google.com/d/msg/django-cms-developers/topic-id/message-id
Unsubscribe: send a message to
[email protected]
---
You received this message because you are subscribed to the Google Groups
"django CMS developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web, visit
https://groups.google.com/d/msgid/django-cms-developers/701835d0-886d-4a18-b465-fe85fc25f73f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.