Sure.
Here’s the template for my shortcode (in MYTHEME/layouts/shortcodes/alert.html
) :
<!-- NB. This version produces the "index out of range" error -->
<div class="alert alert-{{ .Get 0 }}" role="alert">
{{ with (.Get 1) }}<h4 class="alert-heading">{{ . | markdownify }}</h4>{{ end }}
{{ .Inner }}
</div>
And this is how I invoke the shortcode :
<!-- NB. Removing "Some title" triggers the index out of range error -->
{{% alert warning "Some title" %}}
Some content
{{% /alert %}}