How to achieve window.onload with Gatsby
See original GitHub issueI want to add a dynamic meta tags for my website using REST API, I want to achieve something like this: window.onload,
If you notice the page is still loading until that function is done, I want that function to be the GET
call for my meta tags.
Any ideas?
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
How to capture document.ready or window.load events in ...
I think you should add these event listeners in the gatsby-browser.js : // gatsby-browser.js // ES6 export const onClientEntry ...
Read more >Using Gatsby Script Component to Decrease Page Load ...
In this blog post, I want to walk through some of the decisions you will make when you use the Gatsby Script component....
Read more >Reactjs – How to capture document.ready or window.load events in ...
I am relatively new to the Gatbsy framework and I am trying to figure out a way to toggle classes on some elements...
Read more >Improving Gatsby web performance by deferring third-party ...
It was decided that the scripts would load in one of two ways: after a user either scrolled, or navigated to another page....
Read more >Loading an external JS file using Gatsby
Loading an external JS file using Gatsby. Published in 2020 ... appendChild(script) } export const onClientEntry = () => { window.onload ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
How about using react-helmet for the meta tags, and setting the values inside a useEffect hook? This will be run after hydration, so in your app, something like:
How do you use Gatsby in this situation? Do you have a separate site for each company or do you have a single Gatsby site?
And what metatags are you going to update (and for which purpose)? I am asking because updating some of them via javascript makes little sense (i.e. SEO-related).
It is still not entirely clear what you are trying to achieve, so please share a bit more details.
Also, you can always customize html if you have to.