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 ...

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.


  • Go to Dashboard > Design > Edit HTML (else move to next step)
  • Now, search for code in your template (tip: press CTRL + F and paste this code)
  • Paste below given code just Before </body>
Automatic SEO for Images - Add Proper ALT and Title Tags Automatically
<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:not([alt])").attr('title', filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.')));
$("img:not([alt])").attr('alt', filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.')));

//]]>
</script>
Save Your Template

Hot in Week

Popular

Archive

item