How do you add a script into the head

Sorry if I missed this in the docs and I also can’t find answer from googling. I have to add a script into the head tag and what I did was add it by editing the layout/partials in the theme folder. Is this the right way to do it? Thanks.

Yes. It may however depend on how the theme is built.

1 Like

You can override directly in the theme, but, it’s easier to copy the file to your project folder in the equivalent place, and override like that, so you can commit it to your own git repo. If your theme has, say, theme/layouts/partials/head.html, then you can override by copying to /layouts/partials/head.html in your project and make the changes there.

2 Likes

Hi @RickCogley, that’s exactly what I thought of at first but I have no idea how to implement or was unsure it will work. Anyway, I will try it since it seems to be the better way. Thank you!