How to Optimize Images for SEO Automatically
Today I Will Show You How to Optimize Images for SEO Automatically
Lets Start
Here's how to install an automatic SEO code in the image
Step 1. Go To Blogger > Theme > Edit Html
Step 2. Then Copy And Paste The Code Just Above The Code </body>
<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>
<script type='text/javascript'>
//<![CDATA[
var scrollTimer = null;
$(window).scroll(function() {
var viewportHeight = $(this).height(),
scrollbarHeight = viewportHeight / $(document).height() * viewportHeight,
progress = $(this).scrollTop() / ($(document).height() - viewportHeight),
distance = progress * (viewportHeight - scrollbarHeight) + scrollbarHeight / 2 - $('#scroll').height() / 2;
$('#scroll')
.css('top', distance)
.text(' (' + Math.round(progress * 100) + '%)')
.fadeIn(100);
if (scrollTimer !== null) {
clearTimeout(scrollTimer);
}
scrollTimer = setTimeout(function() {
$('#scroll').fadeOut();
}, 1500);
});
//]]>
</script>Next, save the template.Every blog image that you install in an article will automatically have an SEO friendly code.
Discussion & Comments
2 comments:
i dont understand how can this javascript code help for image optimization in bogger images.
please also write some tips for blogger image optimization
i think using this code in blogger theme all images that not have alt text automatically get image file name as alt text. this is good but using this we will not get image ranking we use in posts content.
Post a Comment