Hey there
I’m new to Hugo development. I checked out some examples online and the button doesn’t display as it should. Here is my code in button.html
which is in the layouts/shortcodes
folder
{{ $_hugo_config := `{ "version": 1 }` }}
<a {{ with .Get "href"}} href="{{.}}" target="_blank" {{ end }} class="btn btn-default">
{{ $icon := .Get "icon" }}
{{ $iconposition := .Get "icon-position" }}
{{ if ($icon) }}
{{ if or (not ($iconposition)) (eq $iconposition "left") }}
<i class="{{$icon}}"></i>
{{ end }}
{{ end }}
{{ .Inner }}
{{ if and ($icon) (eq $iconposition "right")}}
<i class="{{$icon}}"></i>
{{ end }}
</a>
and here is the code in my ‘index.md’ file
{{% button href="https://example.com/" %}}Example{{% /button %}}
I also tried this
{{< button href="https://example.com/" >}}Example{{< /button >}}
If it helps, I am using the Ananke theme.
Any help would be appreciated. Thanks!
EDIT:
Here’s how it renders: