Add Targeted internal or external Links On Your Post Keywords Automatically In Blogger
According to OnPage SEO requirements, you need to add internal links to your article. If you don't know you need to add them now, but if you have a lot of items how to add them and when do you want to remove them. link or replace any link, you need to re-edit anything which is not possible but is important for SEO as it will reduce bounce rates.
here we are with some awesome JavaScript code that will add the desired keywords link in each of your posts with just a little bit of code and if you want to edit and replace in all posts you just need to edit a single code in the model. All the keywords in the article will automatically convert to links. There is no need to manually add links on the keywords as they will be converted to automatic links. Internal links are very important in increasing the bounce rate of pages and are useful for on-page SEO.
1) first Go To Your www.blogger.com
2) Open Your Desire Blog, from the menu on your left, click on the theme, from the orange button customize, take a backup of your template, then click on the edit HTML option
3) Now Click Within Code Box.
Press [CTRL+F] To Search </head>
Code.
<script type='text/javascript'>
//<![CDATA[
function doHighlight(bodyText, searchTerm, link) {
var newText = "";
var i = -1;
var lcSearchTerm = searchTerm.toLowerCase();
var lcBodyText = bodyText.toLowerCase();
while (bodyText.length > 0) {
i = lcBodyText.indexOf(lcSearchTerm, i + 1);
if (i < 0) {
newText += bodyText;
bodyText = "";
} else {
if (bodyText.lastIndexOf(">", i) >= bodyText.lastIndexOf("<", i)) {
if (lcBodyText.lastIndexOf("/script>", i) >= lcBodyText.lastIndexOf("<script", i)) {
newText += bodyText.substring(0, i) + '<a href="' + link + '">' + bodyText.substr(i, searchTerm.length) + '</a>';
bodyText = bodyText.substr(i + searchTerm.length);
lcBodyText = bodyText.toLowerCase();
i = -1;
}
}
}
}
return newText;
}
function highlightSearchTerms(searchText, treatAsPhrase, link, divid) {
if (treatAsPhrase) {
searchArray = [searchText];
} else {
searchArray = searchText.split(" ");
}
div = document.getElementById(divid);
var bodyText = div.innerHTML;
for (var i = 0; i < searchArray.length; i++) {
bodyText = doHighlight(bodyText, searchArray[i], link);
}
div.innerHTML = bodyText;
return true;
}
//]]>
</script>
4) Now Click Within Code Box.
Press [CTRL+F] To Search <data:post.body/>
Code.
Now Copy The Below Code And Paste Replace It With <data:post.body/>
Code.
Do The Same If You Found <data:post.body/>
Many Time.
<div expr:id='"summary" + data:post.id'>
<data:post.body/> </div>
<script type='text/javascript'>
highlightSearchTerms('keywords1', true, 'URL of the post1', 'summary<data:post.id/>');
highlightSearchTerms('keywords2', true, 'URL of the post2', 'summary<data:post.id/>');
</script>