Previously I wrote about conditional tags and how to use them to target specific page or page type in a Blogger blog. I also wrote on how to add styling (CSS) code inside a static page conditional tag in order toprovide static pages a layout different from other pages.
In this tutorial I’ll explain how to do the same thing, except this time we don’t use conditional tags. However this approach is limited only to page types that are represented by the
pageType
data tag, namely index, post, archive and static pages.
Here we go,
1. Assign class to body element
First we need to assign a class to the
body
element so that we can reference it from the stylesheet. And the class has to be somehow linked to the page type. We can achieve this by using pageType
data as the class name. We only need to do this once. Here’s what to do:
Find this:
< body expr:class = '"loading" + data:blog.mobileClass' > |
and replace it with this:
< body expr:class = '"loading" + data:blog.mobileClass + " " + data:blog.pageType' > |
No comments:
Post a Comment