Blogger conditional tags 2

 


Identifying Blogger page types is very effective in designing, different Layouts for different Types of pages and placing Page-specific meta tags.

Below are some of the common Blogger conditional tags formats that can help make a blog Dynamic and Awesome. So,

What are the Blogger Page Types? 
Archive Pages,
Index Pages,
Item Pages,
Static Pages,
Error Pages,
Label Pages &
Search Pages.

Lets now checkout the use of conditional tags with each Blogger page type.

1. Archive Page

Blogger pages added by Archive widget that normally has “_archive.html” ending in its URL belong to Archive page type.

<b:if cond='data:blog.pageType == &quot;archive&quot;'>
...CODE...
</b:if>


2. Index Page

Blogger pages with a list of posts are normally called Index pages. Eg - Homepage and Search result page.

<b:if cond='data:blog.pageType == &quot;index&quot;'>
...CODE...
</b:if>

Example - https://amprandom.blogspot.in/search/label/BloggerPages

3. Item Page

Blogger posts created by clicking new post button are called Item pages.

<b:if cond='data:blog.pageType == &quot;item&quot;'>
...CODE...
</b:if>

Conditional Tag for First Blogger post alone

<b:if cond='data:post.isFirstPost'>
...CODE...
</b:if>

Example - https://amprandom.blogspot.in/2017/01/ban-jallikattu-ban-pongal-ban-tamil.html

4. Static Page

Blogger pages created by clicking new page button are called Static pages.

<b:if cond='data:blog.pageType == &quot;static_page&quot;'>
...CODE...
</b:if>

Example - Using one such conditional Tag, I've converted one of my Static Pages into Home Page.
HomePage URL: https://amprandom.blogspot.in/
Static Page URL: https://amprandom.blogspot.in/p/random-tyms.html

5. Error Page

Blogger pages can be redirected to Error pages when directed to non-existent URLs.

<b:if cond='data:blog.pageType == &quot;error_page&quot;'>
...CODE...
</b:if>

Example -
Correct Page: https://amprandom.blogspot.in/2017/01/ban-jallikattu-ban-pongal-ban-tamil.html
Error Page: https://amprandom.blogspot.in/20177/01/ban-jallikattu-ban-pongal-ban-tamil.html

6. Label Page

Blogger label-based pages contain similar or related posted articles.

<b:if cond='data:blog.searchLabel'>
...CODE for all Label Pages...
</b:if>

Specify Label Name in the conditional statement.

<b:if cond='data:blog.searchLabel== &quot;LABEL_NAME&quot;'>
...CODE for specific Label Page...
</b:if>

Example - Label Name: FunPages
https://amprandom.blogspot.in/search/label/FunPages

7. Search Page

Blogger pages that provides a list of posts that matches the given query terms.

<b:if cond='data:blog.searchQuery'>
...CODE for all Search Pages...
</b:if>

Specify Search Query in the conditional statement.

<b:if cond='data:blog.searchQuery == &quot;SEARCH_QUERY&quot;'>
...CODE for specific Search Page...
</b:if>

Example - Search Query: Indian
https://amprandom.blogspot.in/search?q=indian

Comments

Popular posts from this blog

How To Show Only Post Thumbnails And Snippets In Blogger Blog Homepage

Structure of Custom Blogger Template