Skip to content

Is the following code snippet legit in Astro? #2069

Closed Answered by HiDeoo
Ali-Hussein-dev asked this question in Q&A
Discussion options

You must be logged in to vote

In Nextjs I added to the root layout.tsx, so I suppose all pages

In that case, you should be able to use the head global configuration option inside the astro.config.mjs configuration file to add your script to the head of every page.

The example in the documentation should be relative close to what you shared:

starlight({
  head: [
    {
      tag: "script",
      attrs: {
        src: "…",
        "data-website-id": "MY-ID",
        defer: true,
      },
    },
  ],
});

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@Ali-Hussein-dev
Comment options

@HiDeoo
Comment options

Answer selected by Ali-Hussein-dev
@Ali-Hussein-dev
Comment options

@HiDeoo
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants