Trying to validate my amp-img. In this example: http://staging.laineygossip.com/Sasha-Celeb-Finds-Sienna-Miller/Lifestyle/24695/amp#development=1
I get the error: Layout not supported for: container
In the console, the error is: The specified layout 'CONTAINER' is not supported by tag 'amp-img'
Not sure what this error means.
So far I can't find anything in the docs that relates to this error message.
As per google AMP docs, layouts supported:
FILL, FIXED, FIXED-HEIGHT, FLEX-ITEM, NODISPLAY, RESPONSIVE
Also look at this example, I don't think you need quotes around the layout type: https://ampbyexample.com/samples_templates/news_article/
So it should look something like this:
<figure>
<amp-img src="/img/landscape_village_1280x720.jpg"
width=1280
height=768
layout=responsive></amp-img>
<figcaption>Here is a responsive image.</figcaption>
</figure>
Amp defaults to layout="container" if there is no width and height attribute set. So you can get this error even though you have not set a layout.
At the time of my response, this is also the case for amp-img which do not support layout="container" - hence your error.
Layout Documentation
Fix your issue by adding width and height or specifying an appropriate layout.
container
is not supported by the layout
attribute in <amp-img>
. The AMP Docs provide a list of supported layouts you can use.
This error occurs if we do not mention the width and height of an amp image. If the width and height attributes are not specified for an amp image (amp images must be given an explicit size as in width/ height in advance so that the aspect ratio can be known without fetching the image), the inferred layout is container which is not a supported layout for the same AMP Docs and so the error occurs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With