Swift Theme Issue: Blank Width and Height on Img Tag
-
Recently I have enabled “AMP for WP – Accelerated Mobile Pages” plugin and for past few days Google Search Console is reporting many errors, among other one is “Invalid value for attribute in layout ‘width’ in tag ‘amp-img'”.
After having looked thoroughly both Non-AMP and AMP page of few URLs, I have found the error is happening on the
<amp-img>
tag wrapped inside<figure>
to display featured images.But, the same image which is also a top image in the content is rendered properly with src-set and width and height.
Below is an example of the
<figure> <amp-img>
and<amp-img>
inside content.<figure class="amp-featured-image"> <amp-img src='/wp-content/uploads/2018/04/facebook20hero.jpg' width='0' height='0' layout=responsive alt='Facebook Prohibits Political Ads Until Authorised, Increases Accountability on Ads'></amp-img></figure>
<p><amp-img src="/wp-content/uploads/2018/04/facebook20hero.jpg" alt="facebook20hero" width="1150" height="550" class="alignnone size-full wp-image-71451 amp-wp-enforced-sizes" srcset="/wp-content/uploads/2018/04/facebook20hero.jpg 1150w, /wp-content/uploads/2018/04/facebook20hero-300x143.jpg 300w, /wp-content/uploads/2018/04/facebook20hero-768x367.jpg 768w, /wp-content/uploads/2018/04/facebook20hero-1024x490.jpg 1024w, /wp-content/uploads/2018/04/facebook20hero-651x311.jpg 651w" sizes="(min-width: 1000px) 1000px, 100vw"></amp-img></p>
The plugin version installed is 0.9.85.2 and I am using Swift theme.
- The topic ‘Swift Theme Issue: Blank Width and Height on Img Tag’ is closed to new replies.