{{- $url      := .Get "url" -}}
{{- $desc     := .Get "desc" | default (i18n "actions_cta") -}}
{{- $caption  := .Get "caption" | default "" -}}
{{- $use      := .Get "use" | default "site" -}}
{{- $outclass := .Get "outclass" | default "" -}}
{{- $inclass  := .Get "inclass" | default "" -}}

{{- $icons := dict "download" "download" "site" "external-link" "repo" "git-branch" "mail" "mail" -}}
{{- $icon  := index $icons $use | default "external-link" -}}
{{- $isDownload := eq $use "download" -}}

{{- if $url -}}
<div class="cta-block not-prose {{ $outclass }}">
  {{- with $caption -}}
  <p class="cta-block__caption">{{ . }}</p>
  {{- end -}}
  <a
    href="{{ $url }}"
    class="btn btn-primary {{ $inclass }}"
    {{- if $isDownload }} download{{- end }}
  >
    <i data-feather="{{ $icon }}" class="w-5 h-5" aria-hidden="true"></i>
    {{ $desc }}
  </a>
</div>
{{- else -}}
  {{- errorf "actions shortcode: 'url' parameter is required" -}}
{{- end -}}
