Search code examples
wordpressseo

Background images Wordpress SEO


Hi I have several doubts about Wordpress SEO that I don't find answer.

1- I have several a href with background images, I tried to envolve this with a img tag adding the attribute alt but it's shown in each image, How could i hidden it? or what could i do for apply SEO to a background-image adding alt?

<img alt="This is a test" src="<?php echo esc_url( get_permalink()
) ?>">      
    <a href="<?php echo esc_url( get_permalink() ) ?>" class="overlay"></a>         
</img>

2- If i add a keyword on an image, This image keyword compute in the 2%-3% max of keyword in the page?

3- If I add an alt to an image, this alt text would be shown when I search it in Google??


Solution

  • First of all that is invalid HTML. The following is correct:

    <a href="<?php echo esc_url( get_permalink() ) ?>" class="overlay">
    <img alt="This is a test" src="<?php echo esc_url( get_permalink()
    ) ?>" /></a>
    

    You can link an Image, but you can not place a link inside a image in this way.

    This is not a WordPress question but more a general question on SEO. Background images will not affect your SEO (except maybe in terms of bad page load times). They are intended to be background images and therefore do not have a semantic meaning.

    Adding alt text to an image is a good idea especially if the image contains text or has a meaning. Using images with correctly specified alt texts can be good for SEO (at least a little bit).