ampproject / amp.dev

The AMP Project Website.
https://amp.dev
Other
582 stars 694 forks source link

AMP Layout page invalid #6863

Open omerr132 opened 5 days ago

omerr132 commented 5 days ago

The following page is AMP invalid:

The parent tag of tag 'style amp-custom' is 'section', but it can only be 'head'.

https://validator.amp.dev/#url=https://amp.dev/documentation/guides-and-tutorials/learn/amp-html-layout/layouts_demonstrated&errno=0

https://amp.dev/documentation/guides-and-tutorials/learn/spec/amphtml/#stylesheets

jaygray0919 commented 3 days ago

it's valid: https://search.google.com/test/amp/result?id=Fn8wBJDd5Q1wcuWmI0eWbg

omerr132 commented 3 days ago

This is the invalid page: https://amp.dev/documentation/guides-and-tutorials/learn/amp-html-layout/layouts_demonstrated

On Thu, 21 Nov 2024 at 14:02, jay gray @.***> wrote:

it's valid: https://search.google.com/test/amp/result?id=Fn8wBJDd5Q1wcuWmI0eWbg

— Reply to this email directly, view it on GitHub https://github.com/ampproject/amp.dev/issues/6863#issuecomment-2490950427, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGE4I4VPBHYS57FCKFYLSYL2BXDTVAVCNFSM6AAAAABSCA252SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOJQHE2TANBSG4 . You are receiving this because you authored the thread.Message ID: @.***>

jaygray0919 commented 2 days ago

ok, you are correct here's probably what happened. that page needs CSS that is not defined in the SCSS libs and generated as compiled CSS during build. so page authors added compiled CSS and placed it as a second instance of <style amp-custom> in <body> (since they cannot inject it into <head><style amp-custom> during build). there is nothing invalid about the CSS; it's simply "in the wrong place" an easy fix: transform target CSS to SCSS as a specific library and add that SCSS lib to page source.