Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom amphtml-validator for invalid amp #9176

Closed
yosuke-furukawa opened this issue Oct 23, 2019 · 4 comments · Fixed by #9191
Closed

Custom amphtml-validator for invalid amp #9176

yosuke-furukawa opened this issue Oct 23, 2019 · 4 comments · Fixed by #9191

Comments

@yosuke-furukawa
Copy link
Contributor

Feature request

I would like to customize amphtml validator.
our project are using amp html, and we would like to customize our own amp validator.

Is your feature request related to a problem? Please describe.

Currently next.js worker uses buit-in amphtml-validator.
https://github.com/zeit/next.js/blob/canary/packages/next/export/worker.js#L6
https://github.com/zeit/next.js/blob/canary/packages/next/export/worker.js#L151

However amphtml-validator has options to customize validators in here. https://github.com/ampproject/amphtml/blob/master/validator/nodejs/index.js#L295

We would like to inject the custom validators using this options.

If next.js could pass the options, that is really helpful.

const validateAmp = async (html, page, validatorPath) => {
  const validator = await AmpHtmlValidator.getInstance(validatorPath)
  const result = validator.validateString(html)
  // ...
}

Describe the solution you'd like

Add validator options in worker.js.

Describe alternatives you've considered

N/A

Additional context

Related issues:
#9164
#8389

@yosuke-furukawa
Copy link
Contributor Author

I will try to send PR later.

@timneutkens
Copy link
Member

timneutkens commented Oct 23, 2019

@yosuke-furukawa this doesn't explain the "why" you'd want to do that. Can you elaborate on that?

@yosuke-furukawa
Copy link
Contributor Author

@timneutkens
We have 2 reasons of that.

  1. We are creating an AMP application but the application does not follow whole AMP rules currently. i.e, we would like to create AMP but it is not valid AMP now. if we could change the whole situation (such as analytics, advertisement, etc), we could create valid AMP. So currently we would like to attach AMP validation rules gradually.

  2. Default AMP validator downloads the scripts from CDN, we would like to use the fixed version script to lock versions.

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants