How To Ads Not Displaying When Preview Articles

How To Ads Not Displaying When Preview Articles - To hide or deactivate the appearance of an ad when opening an article preview page, we need a special conditional tag. And these conditional tags have only been around since 2017.

Leaving the ad slot still appearing on the post preview page does not have a significant effect on related blogs and Google Adsense accounts. It's just that, the appearance that is often blank is what sometimes disturbs the view when you want to preview prospective blog posts.

How To Ads Not Displaying When Preview Articles

Well, if the appearance of the ad in the preview / preview page of this post also interferes with your comfort, then do the following.

For ads in posts (at the bottom, middle and end of the post)


Go to Blogger >> Theme >> Edit HTML.

Insert this conditional tag in the ad slot:

<b:if cond='!data:view.isPreview'>
<! - Ad code here ->
</b:if>

Example:

<b:if cond='!data:view.isPreview'>
<ins class='adsbygoogle' data-ad-client='ca-pub-XXXXXX' data-ad-format='rectangle' data-ad-slot='XXXXXXXXXX' style='display:block'/>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</b:if>

For ads in widgets (headers, sidebar and footer)


Still in Edit HTML. Use the Jump to widget feature to go to the html widget in your blog template. An example is like this picture:

How To Ads Not Displaying When Preview Articles

How To Ads Not Displaying When Preview Articles

For example, your ad slot is in HTML2. After being in the widget code, please add the code cond='!data:view.isPreview' on the left of the code id='HTML2'.

Examples like this:

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

Then save the theme.

Do the same with other ad slots.

These are tips that I can share about How To Ads Not Displaying When Preview Articles. Hopefully with these brief tips, it can be useful for you. Good luck.

Provide comments relevant to the posted articles and provide critiques and suggestions for the progress of the blog