ampproject / ampproject/amphtml

Add native `img` to the AMP validator

Open
#30,956 15 comments 0 reactions 1 assignee Claimed by @banaag View on GitHub
P2: Soon Stale Type: Feature Request WG: caching
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

## Add native `img` tag to the AMP Validator

This issue falls under the umbrella of changes which are a part of the '`amp-img` deprecation': #30442.

We will be adding the native `img` tag to the validator which will allow for native `img` tags which require the following attributes...

Standard image:

- `alt`
- `decoding=async`
- `height`
- `loading=lazy`
- `src`
- `width`

Hero image:

- `alt`
- `data-hero`
- `decoding=async`
- `height`
- `src`
- `width`

Image using `srcset`:

- `alt`
- `decoding=async`
- `height`
- `loading=lazy`
- `sizes`
- `srcset`
- `width`

## Describe alternatives you've considered

These guidelines are fairly strict, we had considered having looser more granular validation rules for images trying to replicate specific amp-layout considerations, however for ease of development and for user understanding we have decided to start with more strict validation rules and allow for loosening of these restrictions in the future.

## Additional context

For additional documents see this document about [`amp-img` deprecation](https://docs.google.com/document/d/1tLqmz3g0a8PCOWwsQuPZ3Sx0MuqL8ly78I7eA-xOj-Q/edit?usp=sharing), and this document about [allowing native `img`](https://docs.google.com/document/d/135fsDOw-OfVNZbqr-aOY3ZVNKTzwCLcf8z6Dang2ygY/edit?usp=sharing) in valid amp documents.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.