hugo-theme-hilfe/layouts/shortcodes/button.html
2022-06-24 10:54:16 +02:00

27 lines
650 B
HTML

{{- $ref := "" }}
{{- $target := "" }}
{{- $size := default "regular" (.Get "size" | lower) }}
{{- if not (in (slice "regular" "large") $size) }}
{{- $size = "regular" }}
{{- end }}
{{- with .Get "href" }}
{{- $ref = . }}
{{- $target = "_blank" }}
{{- end }}
{{- with .Get "relref" }}
{{- $ref = relref $ . }}
{{- end }}
<span class="gdoc-button gdoc-button--{{ $size }}{{ with .Get "class" }}{{ . }}{{ end }}">
<a
class="gdoc-button__link"
{{- with $ref }}{{ printf " href=\"%s\"" . | safeHTMLAttr }}{{ end }}
{{- with $target }}{{ printf " target=\"%s\"" . | safeHTMLAttr }}{{ end }}
>
{{ $.Inner }}
</a>
</span>