Show a widget on specific parts of a blog

If you want to show a widget or another element only in specific parts of a blog then you can use the following code:

Show the widget only on home page:
<b:if cond="data:blog.url == data:blog.homepageUrl">
(your widget goes here)
</b:if>
Show the widget only on post pages:
<b:if cond="data:blog.pageType == "item"">
(your widget goes here)
</b:if>
Show the widget only on a specific page or URL:
<b:if cond="data:blog.url == "PUT_URL_HERE"">
(your widget goes here)
</b:if>
Show the widget only on archive pages:
<b:if cond="data:blog.pageType == "archive"">
(your widget goes here)
</b:if>
Show the widget only on static pages:
<b:if cond="data:blog.pageType == "static_page"">
(your widget goes here)
</b:if>
Show the widget only on post as well as static pages:
<b:if cond="data:blog.url == data:post.url">
(your widget goes here)
</b:if>
Show the widget only on label-search pages:
<b:if cond="data:blog.searchLabel">
(your widget goes here)
</b:if>


Show the widget only on home, label and archive pages: <b:if cond="data:blog.pageType == "index"">
(your widget goes here)
</b:if>
Conditional tags which you can use with these statements:
You can also use != instead of ==
e.g.
<b:if cond="data:blog.url != data:blog.homepageUrl">
(your widget goes here)
</b:if>
In that case the widget will be shown only if the current page is not the home page
if..else
<b:if cond="data:blog.pageType == "HomePageURL"">
(your widget goes here)<b:else>
another widget can be placed
</b:else></b:if>










































1 comment:

  1. I found this post and in findіng It really helpful & it helped me out muсh. I'm hoping to give something again and aid others like you helped me.
    website design

    ReplyDelete