Optimize Blog Images By Adding Alt and Tit - My Blog

Breaking

Ads by Google Adsense

October 29, 2018

Optimize Blog Images By Adding Alt and Tit

We always keep trying to improve our blog's SEO to be a part of ever improving SEO race. A better SEO let us compete with our competitors and rank better than others in search engines. It becomes very difficult task when it comes to optimizing blog images for SEO. Blogger by default provides adding Alt and Title tags to images manually for better SEO but it really became a headache to add these tags manually to each and every image. So today I am introducing a great script which automatically adds Alt and Title tags to all your blog images in one go. You just need to rename your blog image before uploading as this script fetches the name of images and add it as Alt and Title tags. So let's start adding this great script to yourblogger blog.

How this script works? :

This script simply takes the image name and use it as the title and alt tag for that particular image.

So to use this script carefully, you have to name your post images correctly. An example of an image with alt and title tag is below:

How to Add Script to Add Alt and Title Tags Automatically:

You just need to follow below-given simple steps to successfully add this great script. So let's start:
Go to Your Blogger Dashboard.Open the Theme Tab and Click Edit HTML.Edit your template.Search the </body> tag in your template editor. ( Use Ctrl+F for quick find)Then paste the below code before the </body> tag.

<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' type='text/javascript'/> <script 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> 


Now save it.

You'are done! You have successfully added the script which enhances your blog's SEO and surely increase organic visits too. Now check your blog images by pointing mouse cursor to them.
If you have an e-commerce driven blog or website powered by wordpress and if you need advanced SEO services for an e-commerce site you might have to consult a professional SEO agency.

No comments:

Post a Comment

Your Comments Here...