Support » Plugin: Schema App Structured Data » Image size warning in Google Search Console

  • Resolved Ruwen

    (@ruwen-k)


    Hi,

    I’m seeing a lot of warnings about the structured data on my client’s AMP pages in Google Search Console:
    “Image size smaller than recommended size”

    If my understanding is correct, the image part of the JSON-LD is generated through the getImage method of HunchSchema_Thing, which grabs the first image from the post content.

    The minimum size google recommends for the image is 1200px. So in order to avoid the warnings I would have to include a 1200px image in the content, which is something I don’t want to do for layout and performance purposes.

    I think it would be a good idea to make it possible to change that image. For me a filter that allows me to modify the meta data before the plugin renders the JSON-LD would work great. Much like the way it’s done by the AMP plugin (amp_post_template_metadata).

    Would you consider implementing such a feature? Or is there a way of modifying the image already?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author vberkel

    (@vberkel)

    Hi @ruwen-k

    Good feedback and idea, I’ve created an enhancement request to go over the options to support this.

    Regards,
    Mark

    Ruwen

    (@ruwen-k)

    Hi Mark,

    thanks for your response.
    Please keep me updated.

    Best regards,
    Ruwen

    Plugin Author vberkel

    (@vberkel)

    Hi @ruwen-k

    We have added several new filters in v1.13.0 due out shortly.

    Regards
    Mark

    Ruwen

    (@ruwen-k)

    Hi Mark

    Thanks a lot! The filter allows me to replace the image in case it’s too small.

    To everyone coming here looking for a solution, here is a possible approach:

    function modify_schema_app_image($image) {
    	// replace image in structured data if its smaller than 1200
    	if($image['width'] < 1200) {
    
    		// override image path and dimensions
    		$image['url'] = $pathToFallbackImage;
    		$image['@id'] = $pathToFallbackImage;
    		$image['width'] = $fallbackImageWidth;
    		$image['height'] = $fallbackImageHeight;
    	}
    	return $image;
    }
    add_filter('hunch_schema_thing_markup_image', 'modify_schema_app_image');

    Best regards,
    Ruwen

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Image size warning in Google Search Console’ is closed to new replies.