Shortcode for displaying an html page?

I can’t find the answer to this, but it seems also to be a well-understood issue. I have an html page (an interactive plot) which I can access in a blog page with


Then the plot, once the link is clicked, is displayed neatly in its own page. However, I’d like that plot to be displayed on the current page. Apparently this can be managed with shortcodes, about which I know very little. Also, I can’t find a shortcode to do this particular task. Any advice? Thanks!

Well, it seems like you need a way to reveal a div, and the way I’d approach it is using javascript. You know those sites that hide spoilers until you click? Kind of like that.

A starter on the technique is here:

Once you get it working basically, by just pasting the needed html and/or scripts in your markdown, you can extract that into a shortcode. It’s just a template, with a special syntax, which you store in “shortcodes” and call with a specific code on your markdown page. The docs explain it well.

Would something like this work? You would not need a separate file…

1 Like

No js?! Sweet.

1 Like

Thank you very much indeed! But I think I was unclear about my needs: I want the html to appear on the current blog page, without any need to reveal: it’s just there. In other words, I need an alternative to iframe; that is, if such an alternative exists.

Say you have a shortcode at:


Define it as:

{{ $page := site.GetPage (.Get 0) }}
{{ $page.Content }}

Then use it like:

{{< page_content "/plot" >}}