Hide / Show Widgets on Specified Pages on the Latest Blogger



Since there are already the latest conditional tags, then to hide or display widgets / gadgets on certain pages for Blogger / Blogspot also changes. However, using the old methods can also still be done.

If the widget / gadget that we want to hide or display is part of the header, sidebar or footer gadget, then the method is as follows.

Login to Blogger> Themes> Edit HTML.

Then select the Jump to widget dropdown, as in the following image.



For example, widgets / gadgets that you want to hide are as in the following code:

<b:widget id='HTML2' locked='false' title='Ads' type='HTML'>...</b:widget>

And the widget / gadget you want to hide on the Post Preview page, then just add a special conditional tag like this:

<b:widget cond='!data:view.isPreview' id='HTML2' locked='false' title='Ads' type='HTML'>...</b:widget>

If you want to apply it to other pages, do the following.

1. Only want to display the widget on the front page (homepage)

<b:widget cond='data:view.isHomepage' id='HTML2' locked='false' title='Ads' type='HTML'>...</b:widget>


2. Want to hide widgets on the front page (homepage)

<b:widget cond='!data:view.isHomepage' id='HTML2' locked='false' title='Ads' type='HTML'>...</b:widget>


3. Only want to display the widget on the item page (post page and static page)

<b:widget cond='data:view.isSingleItem' id='HTML2' locked='false' title='Ads' type='HTML'>...</b:widget>


4. Want to hide widgets on item pages (post page and static page)

<b:widget cond='!data:view.isSingleItem' id='HTML2' locked='false' title='Ads' type='HTML'>...</b:widget>


5. Only want to display the widget on the Post page

<b:widget cond='data:view.isPost' id='HTML2' locked='false' title='Ads' type='HTML'>...</b:widget>


6. Want to hide widgets on the Post page

<b:widget cond='!data:view.isPost' id='HTML2' locked='false' title='Ads' type='HTML'>...</b:widget>


7. Only want to display the widget on the Static page

<b:widget cond='data:view.isPage' id='HTML2' locked='false' title='Ads' type='HTML'>...</b:widget>


8. Want to hide widgets on the Static page

<b:widget cond='!data:view.isPage' id='HTML2' locked='false' title='Ads' type='HTML'>...</b:widget>


9. Want to hide widgets on all Search pages

<b:widget cond='!data:view.isSearch' id='HTML2' locked='false' title='Ads' type='HTML'>...</b:widget>


10. Want to hide widgets only on the Label Search page

<b:widget cond='!data:view.isLabelSearch' id='HTML2' locked='false' title='Ads' type='HTML'>...</b:widget>


11. Want to hide widgets only on the Item and Error pages

<b:widget cond='!data:view.isSingleItem or !data:view.isError' id='HTML2' locked='false' title='Ads' type='HTML'>...</b:widget>


12. Want to hide widgets in Blogger Layout Menu

<b:widget cond='!data:view.isLayoutMode' id='HTML2' locked='false' title='Ads' type='HTML'>...</b:widget>


13. Want to Display Widgets on Specified Post pages (certain URLs)

<b:widget cond='data:view.url == "YOUR_URL_HERE"' id='HTML2' locked='false' title='Ads' type='HTML'>...</b:widget>


Example:

<b:widget cond='data:view.url == "https://thanhtuan.host/2020/07/how-to-make-contact-button-integrated.html"' id='HTML2' locked='false' title='Ads' type='HTML'>...</b:widget>


If 2 URLs:

<b:widget cond='data:view.url == "URL_1" or data:view.url == "URL_2"' id='HTML2' locked='false' title='Ads' type='HTML'>...</b:widget>


14. Want to Hide Widgets on Certain Posts (certain URLs)

<b:widget cond='data:view.url != "YOUR_URL_HERE"' id='HTML2' locked='false' title='Ads' type='HTML'>...</b:widget>


15. Want to Display Widgets only on certain Label Name pages

<b:widget cond='data:view.search.label == "LABEL_NAME"' id='HTML2' locked='false' title='Ads' type='HTML'>...</b:widget>


If 2 labels:

<b:widget cond='data:view.search.label == "LABEL_NAME_1" or data:view.search.label == "LABEL_NAME_2"' id='HTML2' locked='false' title='mgid' type='HTML'>


16. Want to Hide Widgets only on certain Label Name pages

<b:widget cond='data:view.search.label != "LABEL_NAME"' id='HTML2' locked='false' title='Ads' type='HTML'>...</b:widget>


If 3 labels:

<b:widget cond='data:view.search.label != "LABEL_NAME_1" and data:view.search.label != "LABEL_NAME_2" and data:view.search.label != "LABEL_NAME_3"' id='HTML2' locked='false' title='mgid' type='HTML'>

Thank you
Mới hơn Cũ hơn

Mới nhất