amp-img error: Layout not supported for: container

Ken Ma picture Ken Ma · Aug 3, 2016 · Viewed 9.3k times · Source

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.

Answer

Ksenia picture Ksenia · Aug 3, 2016

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>