HUGO

Passing in HTML as a shortcode parameter

Hi,
I’m trying to pass in a link (anchor element) as a parameter to a shortcode. I want it to be rendered as an actual link on my website instead of a raw string:
Screenshot 2021-03-31 at 17.34.23
Is this possible to do?

My markdown looks like the following:

{{< videofigure class="hangman-gif-figure" caption=`Here is the finished app which is available on the <a href="https://play.google.com/store/apps/details?id=com.madeleinesmith.hangman" target="_blank">Play Store</a>` >}}
        {{< video src="hangman-finished-app.mp4" class="video-fluid" >}}
{{< /videofigure >}}

and videofigure.html looks like this:

<figure class="figure {{.Get "class"}}">
    {{.Inner|safeHTML}}
    <figcaption class="figure-caption text-center">{{.Get "caption"}}</figcaption>
</figure>

I hope this makes sense! I’m a first timer poster here :blush:

safeHTML the caption

<figcaption class="figure-caption text-center">{{.Get "caption" | safeHTML }}</figcaption>
1 Like

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