Skip to content

Instantly share code, notes, and snippets.

@vinayprajapati
Last active December 18, 2015 22:08
Show Gist options
  • Save vinayprajapati/5852194 to your computer and use it in GitHub Desktop.
Save vinayprajapati/5852194 to your computer and use it in GitHub Desktop.
Ads in mid of Blogger posts manual placement. Just paste <!-- ads --> anywhere in Blogger post and ad will appear there.
<!-- Ads in mid of post: Manual Placement -->
<b:if cond='data:blog.pageType == &quot;item&quot;'>
<div expr:id='"atmid" + data:post.id'/>
<div style="clear:both; margin:10px 0;text-align:center">
<!-- Paste Ad code here: Appear at mid of the post -->
</div>
<div expr:id='"attop" + data:post.id'>
<div style="clear:both; margin:10px 0;text-align:center">
<!-- Paste Ad code here: Appear at top of the post -->
</div>
<data:post.body/>
<div style="clear:both; margin:10px 0;text-align:center">
<!-- Paste Ad code here: Appear at bottom of the post -->
</div>
</div>
</b:if>
<script type="text/javascript">
var obj0=document.getElementById("atmid<data:post.id/>");
var obj1=document.getElementById("attop<data:post.id/>");
var s=obj1.innerHTML;
var r=s.search(/\x3C!-- ads --\x3E/igm);
if(r&gt;0) {obj0.innerHTML=s.substr(0,r);obj1.innerHTML=s.substr(r+13);}
</script>
<!-- Ads in mid of post: Manual Placement -->
@vinayprajapati
Copy link
Author

Just paste anywhere in Blogger post and ad will appear there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment