I've been working on setting up a blog using Gatsby-JS and have run into a bit of an issue. My posts, written in markdown, include inline javascript like this:
<script>window.alert("hello");</script>
When I test the site with "Gatsby serve", the script doesn't execute when I visit my post from the blog index. Strangely, there are no errors in the web console.
However, if I navigate directly to the post page or refresh the page (F5 or ctrl+f5), the alert pops up as expected.
After deploying the site to GitHub Pages, I noticed a change in behavior. Even refreshing or navigating from the index doesn't trigger the script. Only after pressing ctrl+F5 does it work.
If you'd like to see a live test example, you can check out my blog here. It showcases multiple alerts and attempts to load Plotly.