This time I will share some tutorial about blogging, How to make widget only show in Home Page or Post. This trick very useful to make loading page faster also make our blog template more elegant.
The concept to make widget only show in home page or post page, just need to put a little code like this bellow in your template or widget HTML. Check this one :
1. If you need to show the widget only in homepage, you need put this code between your widget code :
This bellow the complete one (example)
The concept to make widget only show in home page or post page, just need to put a little code like this bellow in your template or widget HTML. Check this one :
1. If you need to show the widget only in homepage, you need put this code between your widget code :
<b:if cond='data:blog.url == data:blog.homepageUrl'>2. And if you need to show your widget only in post page, you need put this code :
“Your widget code here”
</b:if>
<b:if cond='data:blog.pageType == "item"'>To make you more understand about this tutorial, this is the application in tamplate HTML. Login into your blogger account ==> edit HTML ==> Expand Template Widget. Try to fine some code like this <b:widget id=
“Your widget code here”
</b:if>
This bellow the complete one (example)
<b:widget id='HTML14' locked='false' title='Artikel Terkait' type='HTML'>The red code is code that you must put, in this case, this widget will be displayed only in homepage. If you need to make it display in post page, just replace the red code with code that I give in above. If you don’t wont to edit via template HTML, you can edit or add this code via layout. Just open your widget HTML code, and put which one code you need. Just easy, right???
<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>
0 comments:
Post a Comment