Powered by Blogger.

How To Install SEO Smart Links in Blogger



How to Install SEO Smart Links in Blogger - This time, Smartpik will share SEO Smart Links plugin for Blogger, Actually, this is a WordPress plugin that changes any given word in an article into a link.

This plugin will read every word specified in the article. For example, if you add word smartphone or computer, then automatically every time the word will turn into a link and only then if in your blog article contained that word.

How to Install SEO Smart Links

As usual Go to Blogger dashboard and select the Template section and click Edit HTML. Then add the following code before </body> tag
<script type='text/javascript'>
function smartLink(){
    this.keywdHref = new Object();
    this.add = function(keyword, href){
        if(keyword.substr(0,1) != &quot; &quot;){keyword = &quot; &quot; + keyword;}
        this.keywdHref[keyword] =  href;
    }
    this.createAnchor = function(){
        var objs = document.getElementsByTagName(&quot;div&quot;);
        for(var i=0; i&lt;objs.length; i++){
            var obj = objs[i];
            if(obj.className.indexOf(&quot;post-body&quot;)&gt;-1){
                var content = obj.innerHTML;
                for(var keyword in this.keywdHref){
                    var href = this.keywdHref[keyword];
                    var newstr = content.replace(keyword, &quot;&lt;a href=&#39;&quot;+href+&quot;&#39;&gt;&quot;+keyword+&quot;&lt;/a&gt;&quot;, &quot;gi&quot;);
                    obj.innerHTML = newstr;
                    content = newstr;
                }
            }
        }
    }
    this.startScript = function(){
        var onLoad = window.onload;
        window.onload = function(){
            if(onLoad){onLoad();}
            setTimeout(&quot;f.createAnchor()&quot;, 100);
        }
    }
}
</script>
<script type='text/javascript'>
var f = new smartLink();
f.add(&quot;smartphone&quot;, &quot;http://www.smartpik.in/search/label/smartphone&quot;);
f.startScript();
</script>
If you want this plugin only appears on post pages or any specific pages, please add conditional tags. Reference post: Essential Conditional Tags For Blogger

On the highlighted code, replace smartphone with your own keyword and replace the highlighted URL http://www.smartpik.in/search/label/smartphone with your blog URL.

In the above you can add other keywords like below, for example
f.add(&quot;SEO&quot;, &quot;http://www.smartpik.in/search/label/SEO&quot;);f.add(&quot;Template&quot;, &quot;http://www.smartpik.in/search/label/Template&quot;);f.add(&quot;Blogger&quot;, &quot;http://www.smartpik.in/search/label/Blogger&quot;);
You can also add words into bold, for example
f.add(&quot;&lt;b&gt;Blogger&lt;/b&gt;&quot;, &quot;http://www.smartpik.in/search/label/Blogger&quot;);
Click on the Result button to watch live demo, Note the word smartphone on the demo article:
That's it! I hope you like this article! Stay tuned for more cool articles!

0 comments:

Post a Comment