This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hello,
I'd like to add a class to the body tag depending on which page I'm on. I'll later use that class in my LESS file for page-specific CSS. I'm using layouts, so my body tag is located in my 'default' layout. What's the most graceful way to do this?
For example, if I'm on the 'contact us' page, I'd like to add a class like so:
<body class="contact-us">
Cheers, Bret
Follow up question. Those solutions work unless the page is in a folder. When the page is in a folder, the variables this.page.id and this.page.baseFileName look like, for example, "blog/category", which doesn't work as a class name. Any suggestions?
Nevermind! I figured out a way around it. I basically set the page id explicitly in function onEnd().
Cheers, Bret
1-6 of 6