AMP Validation

AMP pages are automatically validated with amphtml-validator during development. Errors and warnings will appear in the terminal where you started Next.js.

Pages are also validated during Static HTML export and any warnings / errors will be printed to the terminal. Any AMP errors will cause the export to exit with status code 1 because the export is not valid AMP.

Custom Validators

You can set up custom AMP validator in next.config.js as shown below:

  1. module.exports = {
  2. amp: {
  3. validator: './custom_validator.js',
  4. },
  5. }

Skip AMP Validation

To turn off AMP validation add the following code to next.config.js

  1. experimental: {
  2. amp: {
  3. skipValidation: true
  4. }
  5. }