In the amp base theme, the amptheme_html_head_alter() is removing ALL script tags that are not pulling from the ampproject cdn url. This gobbles up a bit too much. for example, we need to be able to add AMP metadata with a script tag.
It should first check to see if it even has a src attribute defined, separate from where that source is actually coming from.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | interdiff-2734535-2-4.txt | 1.11 KB | rainbowarray |
| #4 | amptheme-script-2734535-2.patch | 1.69 KB | rainbowarray |
Comments
Comment #2
jazzdrive3 commentedThis fixes the issue, while also allowing a #value to be populated inside a script tag again.
Comment #3
jazzdrive3 commentedComment #4
rainbowarrayLetting through all script elements without a src would open the possibility for a module or theme to add a script element with embedded JS, which isn't allowed as per AMP. This closes that loophole but still allows through the JSON necessary for AMP metadata. If we find other exceptions, we can expand that whitelist, but for now I think this should do the trick.
Comment #5
rainbowarrayComment #7
rainbowarray