SEO For Images

Posted by Admin On Saturday, May 19, 2012 0 comments

seo-image

Hi Guys :) Today i will Give You 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 . This will not only optimize new images but will also optimize all images that your blog have in older posts

To add it To your Blogger ► Follow These Steps :

Step 1 : Click 'Layout' ► 'Edit Html' ► 'Expand Widget Templates'. And don't forget to backup your template by download it first.

Step 2 : Find (Ctrl+F) this code in your html.

</body>

Step 3 : Add the code below before the code above.

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

Final : Save your template 

0 comments:

Post a Comment

Facebook Page

Followers