Follow Me

How to Optimize Images for SEO Automatically

How to Optimize Images for SEO Automatically
How to Optimize Images for SEO Automatically - This is done so that the images on your blog page are automatically indexed by search engines like google so you are not bothered by adding them manually (adding a description to <img alt="description of the image" height="125" scr="/image.png" width="125" /> when posting a picture).

This method can be said to be troublesome. With this automatic method, each image has the same description as the image title. Therefore, you must provide the appropriate name for each image that will be posted.

Why do you have Image Optimization to Automatically SEO?

Because the image on the blog page is one of the media that can be used for traffic on search engines because some internet users like to search or just browse to see pictures.

Here's how to install an automatic SEO code in the image

Look for the code </body> in your blog template, then copy and paste the code below 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.

May be useful.
Next Post Previous Post
No Comment
Add Comment
comment url