(hopefully you get the idea, the content isn’t too important)
When I include this call to a partial in my Markdown file its just rendered to the browser as is. How can I tell Hugo/Markdown to call this, execute it, give me the result, do the business as if it was in an HTML file.
I have spent some time trying to find this out but with no luck so apologies if this is easy or already answered. Thanks in advance.
Thanks for the reply. I gave shortcodes a whirl but I couldn’t work out how to get it to work, that page doesn’t mention partials unfortunately. Ultimately to be able to call something like:
If you want to keep things DRY, you can use a partial from a shortcode. The trick is to remember that partials called from shortcodes do not have access to site.blah or $.Site.blah variables because shortcodes context only has access to .Page (and consequently the .Param function is unavailable, BUT (at least with modern Hugo) you can use .Page.Site.blah so you can use default or testing .Page.params and .Page.Site.params to achieve the same result.
It might be easiest to do {{ partial "somepartial" .Page }} from within the shortcodes/someshortcode.html and when writing the partial make sure to avoid site.blah, .Param etc.
That way the partial can be used as usual as well as from a shortcode.