Is the following code snippet legit in Astro? #2069
-
I am not an Astro dev, I need to add a script to {/* src/content/docs/index.mdx */}
{!import.meta.env.DEV && (
<head>
<script
defer
src="..."
data-website-id="...."
></script>
</head>
)} |
Beta Was this translation helpful? Give feedback.
Answered by
HiDeoo
Jun 30, 2024
Replies: 1 comment 4 replies
-
👋 Do you need the script to be added only on the homepage or to all pages? |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In that case, you should be able to use the
head
global configuration option inside theastro.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: