How to Make AutoLink On Writing Or Specific Words in Blogs

Posted by Bloqx Husni on Friday, January 21, 2011

For this tutorial a little review about the link. To make the automatic link on the article or a particular word on a blog - this blogspot to make it more easier for us who no longer embed the link manually, and according to these bloggers can also make us more SEO friendly blog, we live determine what word or phrase that we will expects to be a link.
according to which I know he said in this way will make our article will contain a lot of anchor text and could strengthen the position of the SERP in posting on our blog.
 
For the steps are as follows:

1. Login to Blogger

2. Go to "Layout - Edit HTML"

3. Put this code under Prior Code:
   </head>

<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. The next step Find Code: <data:post.body/>

If you use readmore, the code will be there two, Find the second such code.

5. The code was then Delete and replace with Code Below

<p> <div expr:id='&quot;summary&quot; + data:post.id'> <data:post.body/> </div> <script type='text/javascript'> highlightSearchTerms('keywords1',true,'http://link1.blogspot.com','summary<data:post.id/>'); highlightSearchTerms('keywords2',true,'http://link2.blogspot.com','summary<data:post.id/>'); </script> </p>

Description: Replace Keywords1 along the link as you want,
and to add keywords and links, just add it Code:

highlightSearchTerms('keywords',true,'http://link.blogspot.com','summary<data:post.id/>');

and replace the keywords such as the above information and the link as desired, then Save Template And see the result. Good luck good luck ...!


if there are less obvious? please leave a message!
or anyone willing to be corrected?

happy blogging
RELATED POST

{ 0 comments... read them below or add one }

Post a Comment