htmlcssxmlbloggerblogspot

How Can I Add Separate Unique Body Class To Pages on Blogger Blog


I want to automatically add unique class names for Homepage and Post page to the <body> tag.

Example:

Show <body class='post-page'> on post page and

Show <body class='homepage-page'>on homepage


Solution

  • Use the b:class operator for achieving this. It works by adding classes to the parent element. The code will look like -

    <body>
       <b:class cond='data:view.isPost' name='post-page'/>
       <b:class cond='data:view.isHomepage' name='homepage-page'/>