Follow us on Facebook

Automatic SEO for Images - Add Proper ALT and Title Tags Automatically


Earlier i told you best seo tips for images which were all manually to be followed. However, its not that easy to optimize each and every image for search engines. So, here is a JavaScript code for your blog which will add all necessary attributes such as ALT, Title etc to your images and optimize all your blog images for search engines. This is one of the easiest way to optimize all images in your blog posts and implementation process only takes less than a minute. This will not only optimize new images but will also optimize all images that your blog have in older posts.

How to Add ALT tag and Title TAG Automatically for Search Engine Optimization

  • Using Blogger ? Go to Dashboard > Design > Edit HTML (else move to next step)
  • Now, search for </body> code in your template (tip: press CTRL + F and paste this code)
  • Paste below given code just Before </body>


<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' type='text/javascript'/>
<script type='text/javascript'>
//<![CDATA[
$(document).ready(function() {
$('img').each(function(){
var $img = $(this);
var filename = $img.attr('src')
$img.attr('alt', filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.')));
});
});
//]]>
</script>
<script type='text/javascript'>
//<![CDATA[
$(document).ready(function() {
$('img').each(function(){
var $img = $(this);
var filename = $img.attr('src')
$img.attr('title', filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.')));
});
});
//]]>
</script>
  • Save Your Template
  • Thats it...

1 comment:

  1. No it's not working in a right way.
    Adding + symbol in spaces

    ReplyDelete

About

Followers

Like Us

Labels

Donate us For Furture