We are always worry about SEO (search engine optimization) of our blogs. Images is the integral part of blogger posts. Many people do not know that search engines bot unable to read images, so tells about the images to search engines; we add Alt tags to all blog images. It is very difficult and time consuming to add manually Alt tag to all blog images. Today I am sharing a code that automatically adds ALT and title tag to your blogger images. With this simple and short code, you save a lot of time and optimize your blogger images with great ease.
How this code Work
This code takes the name of your image and use it as Alt and Title tag of your blog images. So, before use this code, give a proper name your images.How to add this code
- Go to your blogger dashboard and select desire blog.
- Go to blog template and Edit HTML (Before adding this code backup your Template.)
- Now Search the </body> in coding area
- Paste the below code just above </body> it.
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.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('title', filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.')));$img.attr('alt', filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.'))); }); });//]]> </script>
- Save the Template and enjoy it.
Comments
Post a Comment