I am trying to make a shortcode that wraps text into a div container that has style appled to a title heading and the paragraph text.
The goal here is that I want to check for a parameter “url” and if it exists then style the heading code with link markup. I have no idea how to use shortcode statements but below is the code. Maybe someone can point out where I going wrong. The shortcode is not rendering at all so I must be missing something:
shortcode example:
{{% alert title="This is a container header" url="/path/" %}}
This is the container text
{{% /alert %))
alert.html:
<div class="alert-container">
<h4>
{{.Get "title"}}
{{ if isset .Params "url" }}
{{ with .Get "url" }}<a href="{{.}}">{{.Get "title"}}{{ end }}</a>
</h4>
{{ .Inner }}
</div>
{{ if and (isset .Params "url") (isset .Params "title" ) }} <-- both set
<a href="{{ .Get "url" }}">{{.Get "title"}}</a>
{{ else if (isset .Params "title" ) }} <-- only title set
{{.Get "title"}}
{{ else }} <-- neither set
{{ .Inner }}
{{ end }}