4

I have this code in the index.js of layout folder:

<StaticQuery
    query={graphql`
      query SiteTitleQuery {
        site {
          siteMetadata {
            title
          }
        }
      }
    `}
    render={data => (
      <>
        <Helmet
          title={data.site.siteMetadata.title}
          meta={[
            {name: 'description', content: 'Sample'},
            {name: 'keywords', content: 'sample, something'},
          ]}
          script={[
            {"src": "http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js", "type": "text/javascript"}
          ]}
        >
          <html lang="en" />

        </Helmet>
        <Header siteTitle={data.site.siteMetadata.title} />
        <div>
          {children}
        </div>
        <Footer />
      </>
    )}
  />

However the Bootstrap.js file is not included in the project... I tried various syntax things and also restarted the project, nothing works so far.

stijn.aerts
  • 6,026
  • 5
  • 30
  • 46

1 Answers1

2

Helmet supports all valid head tags like title, base, meta, link, noscript, style, including script tag. So you can do it like this :

<Helmet>
  <script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js" type="text/javascript" />
</Helmet>
Saša Šijak
  • 8,717
  • 5
  • 47
  • 82