I am trying to add an external embed code to my Gatsby page.
I currently use
import React from \'react\'
import Link from \'gatsby-link\'
let test
One way - perhaps the preferred way - is using the SSR file.
From the docs:
The file gatsby-ssr.js lets you alter the content of static HTML files as they are being Server-Side Rendered (SSR) by Gatsby and Node.js. To use the Gatsby SSR APIs, create a file called gatsby-ssr.js in the root of your site. Export any of the APIs you wish to use in this file.
A tutorial on how to do that is here: https://uxworks.online/how-to-add-a-script-in-head-or-body-tag-in-your-gatsby-website/
It uses the setHeadComponents method to inject into html.js:
setHeadComponents
It takes an array of components as its first argument which will be added to head components during building time and which will be passed to html.js.