How to provide fallback AMP Structured data

  • What’s your URL? roettgers.co
  • What version of Ghost are you using? latest

Is there a way to add fallback information to AMP pages?
Google Search Console is showing me an AMP warning, because my structured data doesn’t have an image tag (I’m using the default Ghost AMP template), probably because none of my posts have one.

Is there a way to add fallback information (like a fallback image, when the post doesn’t have one)?

For reference, this is the rich results validation of my sites amp page: https://search.google.com/test/rich-results?id=U9SsuDFUO3j1Gd2B1dz01A

Hey @will :wave:
You could create your own custom AMP template and provide a fallback image if the feature image isn’t set? We have complete guide here on how to create custom AMP templates:

Thanks for the reply :slight_smile:

I read that tutorial, as I understand the image is set in the json+ld script tag, which is automatically set by {{amp_ghost_head}}, is there a way to provide it myself (access the data used by {{amp_ghost_head}})?

The bast way to do this would be to check for the feature image and then optionally set the amp_ghost_head if it’s there, and then build your own custom head code if it’s not :blush:

Thank you, didn’t think of that approach :slight_smile:

1 Like