amp-img error: Layout not supported for: container

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.

Tags:

Amp Html