Adding a javascript heavy html page?

I have an interactive map I’d like to display; it has been created with a lot of javascript in it. I could take the entire html file of the map and put it between some script tags, and this is how I’ve incorporated javascript in my blog before: see https://numbersandshapes.net/post/egg_graphs/ for an example.

But I don’t want to clutter my markdown with 7675 lines of code!

How can I read in the contents of an html+javascript file into my hugo blog without having to display the source of entire file itself? Thanks!

You could put the JS into a shortcode

Thank you - but I’ve not much experience with shortcodes. I can simply add a link to the file, of course, but it would be nice for the map to appear on the page of its explanatory post.

Yep, this can be accomplished with a shortcode. You would place your JS in the shortcode, then call it from your content file. I recommend giving the docs on them a read

Thank you again - so far I haven’t found what I want in the docs, but I’ll keep looking. I was hoping something like

#+begin_src html
/url-of-map.html
#+end_src

would work, but clearly I need something more sophisticated than that.

I solved it by putting it into an iframe. Simple and effective!