Wednesday, February 17, 2016

Blogger Global Conditional Data Tags for All Page Types

1. AND_OR_NOT TAG

#AND

<b:if cond='data:blog.pageType == "index"'>
  <b:if cond='data:blog.searchQuery'>
    <!--search_page AND index_page-->
  </b:if>
</b:if>

#OR

<b:if cond='data:blog.url == data:blog.canonicalHomepageUrl + &quot;p/foo.html&quot;'>
  <!-- static_site foo OR static_site bar -->
      <b:else/>
<b:if cond='data:blog.url == data:blog.canonicalHomepageUrl + &quot;p/bar.html&quot;'>
  <!-- static_site foo OR static_site bar -->
   </b:if>
</b:if>


#NOT

<b:if cond='data:blog.pageType != "index"'>
  <!-- all pages NOT index pages -->
</b:if>

<b:if cond='data:blog.url != data:blog.homepageUrl'>
  <!-- all pages NOT homepage -->
</b:if>
2. Archive Page Tag
<b:if cond='data:blog.pageType == "archive"'>
  <!--archive_Page-->
</b:if>
error_page
<b:if cond='data:blog.pageType == "error_page"'>
  <!-- all error pages-->
</b:if>
index_page
<b:if cond='data:blog.pageType == "index"'>
  <!-- all index pages -->
</b:if>

<b:if cond='data:blog.url == data:blog.homepageUrl'>
  <!-- only homepage -->
</b:if>

3. Item Page Tag
<b:if cond='data:blog.pageType == "item"'>
  <!-- all item pages -->
</b:if>

<b:if cond='data:blog.url == data:blog.canonicalHomepageUrl + "2014/08/foo.html"'>
  <!-- a item page from august 2014 with post-title 'foo'-->
</b:if>
label_page
<b:if cond='data:blog.searchLabel'>
  <!-- all label pages -->
</b:if>

<b:if cond='data:blog.searchLabel == "foo"'>
  <!-- for label 'foo' -->
</b:if>

4. Search Page Tag
<b:if cond='data:blog.searchQuery'>
    <!-- all search pages -->
</b:if>

<b:if cond='data:blog.searchQuery == "foo"'>
  <!-- for query 'foo' -->
</b:if>
static_page
<b:if cond='data:blog.pageType == "static_page"'>
  <!-- all static pages -->
</b:if>

<b:if cond='data:blog.url == data:blog.canonicalHomepageUrl + "p/foo.html"'>
  <!-- a specific static page with name 'foo' -->
</b:if>

AJ

Author & Editor

Quiet type and Creative, he enjoys creating and exploring new trends on the Internet. Microsoft Certified IT Professional, Network Analyst, Autodidact, Philosopher, Developer, WiFi Believer and an Entrepreneur at heart.

0 comments:

Post a Comment