How to Display Widgets on Specific Pages

author photo
Hi bloggers, how are you all? hopefully in good health and always cheerful. In this article, I will share the knowledge I've learned to you is still about the blogger and the topics I discuss this time is about the "Displaying a widget on a certain page" are often used in the template megazine, for example you want to display the widget posted on the post course or no yard only post.

Well we just learned together.

The first step you should do is to enter the "Design" then go to the "Edit HTML" and then check the "Expand widget templates"

and look for code like this widget
<b:widget id='HTML1' locked='false' title='Message' type='HTML'>
<b:includable id='main'>

<!-- only display title if it's non-empty -->
<b:if cond='data:title != &quot;&quot;'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>

<b:include name='quickedit'/>

</b:includable>
</b:widget>

To facilitate the search please enter the title of the widget such as "Message" into the browser's search box (ctrl + F)

Then add code

<b:if cond='data:blog.url == data:blog.homepageUrl'>

and closed with the code </b:if>  to put in only the front page only

and placed as below
<b:widget id='HTML1' locked='false' title='Pesan' 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 != &quot;&quot;'>
<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 the placement of code that is green!

then save.

And below is the code that can be used for other placement

To put on the front page / index used code
<b:if cond='data:blog.pageType != data:blog.homepageUrl'>

   
To put it in the yard Archive

<b:if cond='data:blog.pageType == "archive"'>

To place an item page / posting it used code

<b:if cond='data:blog.pageType == "item"'>

And for the static pages or pages used blogger page

<b:if cond='data:blog.pageType == "static_page"'>

And for additional, if you want to put on a particular page using the URL use the code below

Replace code URL_HERE with the URL you want to show.
<b:if cond='data:blog.url == "URL_HERE"'>


And for exceptions, for example you do not place the widget only on the front page just by replacing the first = sign with the sign!

example


<b:if cond='data:blog.pageType != data:blog.homepageUrl'>

may be useful
Next article Next Post
Previous article Previous Post