How to Show/Hide Blogger Widgets On Specific Page?

♠ Posted by Unknown in at 01:01

Once you added any widget in yourblogger blog, then it will be displayed in all the pages by default, including your homepage. But what to do if you want a certain widget to appear only on a certain posts or pages, can it be easily done? Yes You can do this easily using some conditional tags. This trick is very useful for every blogger to make their blog professional and use the widget where it is required. So In this post I will show you how to perform this task easily.


Hiding/Showing Widget on Specific Location:

Step 1. Go to blogger Dashboard >> Layout >> Add a gadget >> Html/JavaScript. Doing this it will be easier to identify the widget name in your Blogger Template. Give it a new unique name or title or its does not match with any of the widget title or any widgets already added. in your blog.


Step 2. Go to Template and Click on Edit HTML




Step 3. Find the name of the widget by using CTRL+F.  Let’s say that the the name of my widget is ( Recent Posts ). After searching this name. You find a similar code like this.

<b:widget id='HTML1' locked='false' title='Recent Posts' type='HTML'>
<b:includable id='main'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>
<b:include name='quickedit'/>
</b:includable>
</b:widget>
Step 4. After find your widget’s code add the following conditional tags marked with red just below and above to hide the widget from specific pages or posts in Blogger. 

To show the widget only in Homepage 



<b:widget id='HTML1' locked='false' title='Recent Posts' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.url == data:blog.homepageUrl'><!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>
<b:include name='quickedit'/>
</b:if></b:includable>
</b:widget>
To show the widget in a specific page  


<b:widget id='HTML1' locked='false' title='Recent Posts' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.url == "URL of the page"'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>
<b:include name='quickedit'/>
</b:if></b:includable>
</b:widget>

Note: URL of the page Replace by your website link 

To hide a widget only in a particular page
 <b:widget id='HTML1' locked='false' title='Recent Posts' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.url != "URL of the page"'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>
<b:include name='quickedit'/>
</b:if></b:includable>
</b:widget> 
To show widgets only in static pages 
<b:widget id='HTML1' locked='false' title='Recent Posts' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.pageType == "static_page"'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>
<b:include name='quickedit'/>
</b:if></b:includable>
</b:widget>

To hide widgets in Static Pages   
<b:widget id='HTML1' locked='false' title='Recent Posts' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.pageType != "static_page"'><!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>
<b:include name='quickedit'/>
</b:if></b:includable>
</b:widget>

To show widgets only in Archive Pages 
<b:widget id='HTML1' locked='false' title='Recent Posts' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.pageType == "archive"'><!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>
<b:include name='quickedit'/>
</b:if></b:includable>
</b:widget>

Step 5. After added the conditional tags. Now Save your Template and View your Blog.

2 comments:

It is a very nice topic. I have enjoyed it a lot also learn some new things. I hope you will carry on and give me a space to connect with you for a long. I want to know something more about phishing attack. Ethical hacking is a very important issue. On the other hand, some people should know some techniques to remain secure from hacking. Thank you very much. I will read it again . My site is www.hackerslist.co

It is a lovely subject. I learned some new stuff and really enjoyed it. I'm hoping you'll keep going and give me some time to connect with you. I'm interested in learning more about phishing attacks. A crucial topic is ethical hacking. However, certain people need to be aware of certain methods to protect themselves against hackers. I sincerely appreciate it. I'll read it once more. My website's URL is hackerslist.co.

Post a Comment