Load a partial if it's the user's first time on the site

How can I load a partial if it’s the user’s first time on the site? I know about using localStorage, but I don’t know how to load a partial through a .js file, and I was wondering if Hugo has something for this. Either running a js if statement through an .html, or loading a Hugo partial through a .js

Open to all suggestions, thank you!

Hugo is a static site generator, all html is generated at build time, so there is no ‘user’ at that point. If you want to do ‘anything’ in response to a user visit it will need to be done with js and that is outside the scope of this forum. Hugo has finished its job before your pages are uploaded to a web server.

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.