I'm using the Drupal AMP module,theme and library in Drupal 7

I'm using the AMP verification tool here validator.ampproject.org

I have the amp-sidebar working fine except the JavaScript causes an error. When adding the AMP internal js file I get the below error when validating.

<script async custom-element="amp-sidebar" src="https://cdn.ampproject.org/v0/amp-sidebar-0.1.js"></script>

I get the following warning

"The tag 'script' is disallowed except in specific forms."

The second error i get is the following. And as a result of that I get this error The tag 'amp-sidebar extension .js script' is missing or incorrect, but required by 'amp-sidebar'. Learn more.

I have included the full HTML file contents below if you want to run it through the validator to see the errors live, Just copy and paste the code. Pastebin of full Drupal AMP page

1 Answer 1


Add the AMP component JS in the <head> section of your document, then it will be ok.

<script async custom-element="amp-sidebar" src="https://cdn.ampproject.org/v0/amp-sidebar-0.1.js"></script>

Extended components are loaded by including a tag in the head of the document https://www.ampproject.org/tr/docs/reference/spec

  • Thanks David you were exactly correct. I updated your answer to highlight that the script needs to be added in the html.tpl.php file for it to be added to the head of the document.
    – Samp
    Commented May 22, 2017 at 21:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.