nuxt-community / amp-module

AMP Module for Nuxt 2
https://codesandbox.io/s/github/nuxt-community/amp-module/
MIT License
204 stars 36 forks source link

script property is not working in head() #272

Open serdaronedio opened 3 years ago

serdaronedio commented 3 years ago

Hi there;

When i use amp mode in a page, script property isn't working in head() methods. I need to add custom script to the page. How can i fix it?

Thanks a lot.

<template>
  <div>The test</div>
</template>

<script>
export default {
  amp: 'only', // if i remove this line, script prop is working in head(),
  ampLayout: 'default.amp',
  head() {
    return {
      title: 'Test title', // working
      "script": [
        {
          innerHTML: `window.test = 'abcd1234'`,
          type: 'text/javascript',
          charset: 'utf-8',
        },
      ], // script props is not working on ssr,
    }
  }
}
</script>
NaraTouch commented 2 years ago

I also facing this issue as well.