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

🚨 fix(lint): AMP validation fails for redirect pages #54

Open
3 tasks
chriskyfung opened this issue Jan 16, 2024 · 0 comments
Open
3 tasks

🚨 fix(lint): AMP validation fails for redirect pages #54

chriskyfung opened this issue Jan 16, 2024 · 0 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed javascript Pull requests that update Javascript code

Comments

@chriskyfung
Copy link
Owner

Description

The AMP validator reports two errors for the redirect pages, like this:

FAIL: <path>\index.html
line 1, col 224: The attribute 'http-equiv' may not appear in tag 'meta'. (see undefined)
line 3, col 385: Custom JavaScript is not allowed. (see https://amp.dev/documentation/guides-and-tutorials/learn/validation-workflow/validation_errors/#custom-javascript-is-not-allowed)

Steps to reproduce

  1. Run the AMP validator after building the site files using npm run build
  2. Observe the errors in the console output

Expected behavior

The redirect pages should pass the AMP validation without any errors.

Actual behavior

The redirect pages fail the AMP validation with two errors.

Environment

Potential solution

To solve the AMP validation errors in the redirect template, follow these steps:

  • Remove the <meta http-equiv="..."> tag. This tag is not allowed in AMP documents, as it can interfere with the AMP cache and the browser's rendering.
  • Replace the <script> tag with an <amp-script> tag. This tag allows you to run custom JavaScript in AMP documents, as long as you follow the amp-script guidelines.
  • Validate your AMP page again using Google’s Structured Data Testing Tool or the AMP validator.
@chriskyfung chriskyfung added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers javascript Pull requests that update Javascript code labels Jan 16, 2024
@chriskyfung chriskyfung changed the title 🚨 fix (lint): AMP validation fails for redirect pages 🚨 fix(lint): AMP validation fails for redirect pages Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed javascript Pull requests that update Javascript code
Projects
None yet
Development

No branches or pull requests

1 participant