Today I received an email from Google Search Console stating:
Google systems have detected that some of your AMP pages do not meet our guidelines and will therefore not show in Google Search AMP-related features. The following report provides examples of pages with errors.
Upon further investigation using the Structured Data Testing Tool there was an issue with an image missing. Specifically the warning read Image missing and required.
How to fix the Image missing and required AMP error
What this error was saying was that the page didn’t include a featured image. I’ve published almost a thousand posts on this website with my blogging most recently being about Mailchimp training and help. I haven’t ever included featured images in my posts and to add a featured image to hundreds of posts would be very time consuming.
Fortunately it is very simple to add a default featured image to all posts that don’t include a featured image. It’s important that your image meets the specifications which are:
- Image must be a minimum of 696px wide.
- Must be png, gif or jpg filetypes.
- Must be crawlable and indexable by search engines such as Google.
Follow these steps to include your default image and solve the image missing AMP error (h/t Brad Brown):
- Upload your image to your WordPress media library.
- Save the following to your WordPress functions.php file (change the ‘url’ and ‘height’ and ‘width’ as necessary)
add_filter( 'amp_post_template_metadata', 'organicweb_amp_modify_json_metadata', 10, 2 ); function organicweb_amp_modify_json_metadata( $metadata, $post ) { if (!array_key_exists('image', $metadata)) { $metadata['image'] = array( '@type' => 'ImageObject', 'url' => 'https://example.com//srv/htdocs/wp-content/uploads/2016/10/OrganicWeb-Mailchimp-Experts.png', 'height' => 300, 'width' => 700, ); } return $metadata; }
Your posts will now have a default featured image where you haven’t specifically added a featured image. This will satisfy the Google image requirements for WordPress AMP pages.
Leave a ReplyCancel reply