Adding a subscribe form popup after a few seconds

What is the best way to add a subscriber form popup to a static site built by Hugo?
I found this article but tried to implement it and it didn’t work. I would like when a visitor visits my site after a few second see a popup window that allows the visitor to register. I am interested to use formspree.io as well. Any example or resource on this is really appreciated.
Thanks so much.

This is not Hugo related.

I’ll give you a couple of hints though. Your form needs to go into a partial and then you call it in your templates. You include the relevant JS under /static/ and call it just before the body closing tag. Read the Docs and view the repos of Hugo themes for examples.

Also if that tutorial doesn’t work for you, search StackOverflow or Codepen or a blog for another one.

Closing this thread…

EDIT
In the tutorial you linked to, the author places the JS under /themes/ that is just plain wrong, like I said above it goes under /static/

Reopening this thread. So that you can reply if that fixed your issue. But generally speaking frontend JS and CSS are not related to Hugo.

Thanks for the response.

But with the examples of what I have seen in Hugo, the js and css folders are under: themes/theme_name/static/css and themes/theme_name/static/js
So when I run a local copy on my computer by going to: http://localhost:1313/
I assume I don’t need to copy anything from themes/theme_name/static/css and from themes/theme_name/static/js to static/css and static/js, correct?

As for partials I usually see footel.html and header.html under:
themes/theme_name/layouts/partials
I added the scripts shown on that blog in the footer.html

Still I don’t see any popup.

I appreciate your help, thank you very much.

That’s right, you don’t need to copy that yourself; Hugo does that for you.

That’s the good approach and indeed the common location for footer.html and header.html.

Why you don’t see the popup is not something we can answer here; there’s not about information about it. From how you describe it, it seems you used the right Hugo template files to have the JavaScript in your page. But we cannot say based on your descriptions why the JavaScript isn’t running like it should.


NOTE: For people interesting in answering this question, please be advised that a duplicate is posted here on StackOverflow.