- Get link
- X
- Other Apps
- Get link
- X
- Other Apps
1. Go to blogger and sign in into account.
2. Click on 'template' from the drop down menu.
3. Click on Open the
"Edit HTML" button.
4. Click
anywhere inside the code box area
and press the CTRL + F keys (or
Command + F) on your keyboard. This will open up the editor' search box.
5. Then search for the following line by coping and pasting into the
search box :
<data:post.body/>
6. It is important to know that there will be many <data:post.body/
>, but you should stop at the second one. If you try the second one and you did not see any result, then try
the last one.
7. Add this code <div id='adsense-
target'> before it and this code after it, </div> so that it will look
like this,
<div id='adsense-
target'> <data:post.body/></div>
8. The next step is to copy the AdSense code
you want to display and then convert it into plain text.
9. Then just above the line that we just
found, add the following HTML
and replace the "ADSENSE CODE
HERE" text with the converted ad
code:
<b:if cond='data:blog.pageType
== "item"'>
<div id='adsense-content'
style="display:block;text-align:
center">ADSENSE CODE HERE</
div></b:if>
note: only replace the ADSENSE CODE HERE with your adsense code that
you have converted into plain text. If you don't know to convert
adsense code to plain text, search online for tools that could convert
it.
By default, the adsense ads will showat the middle of your post after
the first paragraph (by default).
However you can modify the adsense ads to show to the left of your
page instead of the middle.
To do this
change <div id='adsense-
content' style="display:block;text-
align: center"> with
the following
<div id='adsense-content'
style="display: inline-block;float:
left;margin:15px 15px 15px
0px">
and if you want it to show at the right hand side of your post , change <div
id='adsense-content'
style="display:block;text-align:
center"> with the following text
<div id='adsense-content'
style="display:inline-
block;float:right;margin:15px
0px 15px 15px">
note: the above practice is done above or on top of this code in step 7:
<div
id='adsense-
target'><data:post.body/></div>
10. You should now add the below script after or below the above code:
<script type='text/javascript'>
function insertAfter
(addition,target) {
var parent = target.parentNode;
if (parent.lastChild == target) {
parent.appendChild(addition);
} else {
parent.insertBefore
(addition,target.nextSibling);
}
}
var adscont =
document.getElementById
("adsense-content");
var target =
document.getElementById
("adsense-target");
var linebreak =
target.getElementsByTagName
( "br");
if (linebreak.length > 0){
insertAfter( adscont,linebreak[0]);
}
</script>
Important Note:
- To insert the ad after the
second paragraph, change "0"
from the line towards the end with "2".
- If you want to put AdSense just
below the heading h2 or
heading h3 of a post, then replace br
from "br" with h2 or
h3.
11. Then Click "Save template" to save
the changes.
2. Click on 'template' from the drop down menu.
3. Click on Open the
"Edit HTML" button.
4. Click
anywhere inside the code box area
and press the CTRL + F keys (or
Command + F) on your keyboard. This will open up the editor' search box.
5. Then search for the following line by coping and pasting into the
search box :
<data:post.body/>
6. It is important to know that there will be many <data:post.body/
>, but you should stop at the second one. If you try the second one and you did not see any result, then try
the last one.
7. Add this code <div id='adsense-
target'> before it and this code after it, </div> so that it will look
like this,
<div id='adsense-
target'> <data:post.body/></div>
8. The next step is to copy the AdSense code
you want to display and then convert it into plain text.
9. Then just above the line that we just
found, add the following HTML
and replace the "ADSENSE CODE
HERE" text with the converted ad
code:
<b:if cond='data:blog.pageType
== "item"'>
<div id='adsense-content'
style="display:block;text-align:
center">ADSENSE CODE HERE</
div></b:if>
note: only replace the ADSENSE CODE HERE with your adsense code that
you have converted into plain text. If you don't know to convert
adsense code to plain text, search online for tools that could convert
it.
By default, the adsense ads will showat the middle of your post after
the first paragraph (by default).
However you can modify the adsense ads to show to the left of your
page instead of the middle.
To do this
change <div id='adsense-
content' style="display:block;text-
align: center"> with
the following
<div id='adsense-content'
style="display: inline-block;float:
left;margin:15px 15px 15px
0px">
and if you want it to show at the right hand side of your post , change <div
id='adsense-content'
style="display:block;text-align:
center"> with the following text
<div id='adsense-content'
style="display:inline-
block;float:right;margin:15px
0px 15px 15px">
note: the above practice is done above or on top of this code in step 7:
<div
id='adsense-
target'><data:post.body/></div>
10. You should now add the below script after or below the above code:
<script type='text/javascript'>
function insertAfter
(addition,target) {
var parent = target.parentNode;
if (parent.lastChild == target) {
parent.appendChild(addition);
} else {
parent.insertBefore
(addition,target.nextSibling);
}
}
var adscont =
document.getElementById
("adsense-content");
var target =
document.getElementById
("adsense-target");
var linebreak =
target.getElementsByTagName
( "br");
if (linebreak.length > 0){
insertAfter( adscont,linebreak[0]);
}
</script>
Important Note:
- To insert the ad after the
second paragraph, change "0"
from the line towards the end with "2".
- If you want to put AdSense just
below the heading h2 or
heading h3 of a post, then replace br
from "br" with h2 or
h3.
11. Then Click "Save template" to save
the changes.
Comments
Post a Comment