How to correctly add Google AMP .js files to my theme 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.

&lt;script async custom-element="amp-sidebar" src="https://cdn.ampproject.org/v0/amp-sidebar-0.1.js"&gt;&lt;/script&gt;


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
Add the AMP component JS in the &lt;head&gt; section of your document, then it will be ok.

&lt;script async custom-element="amp-sidebar" src="https://cdn.ampproject.org/v0/amp-sidebar-0.1.js"&gt;&lt;/script&gt;



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