hugo-theme-hilfe/layouts/shortcodes/button.html

28 lines
650 B
HTML
Raw Normal View History

{{- $ref := "" }}
{{- $target := "" }}
{{- $size := default "regular" (.Get "size" | lower) }}
{{- if not (in (slice "regular" "large") $size) }}
{{- $size = "regular" }}
{{- end }}
2020-01-12 15:33:02 +01:00
{{- with .Get "href" }}
{{- $ref = . }}
{{- $target = "_blank" }}
{{- end }}
2020-01-12 15:33:02 +01:00
{{- with .Get "relref" }}
{{- $ref = relref $ . }}
{{- end }}
2020-01-12 15:33:02 +01:00
<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>
2020-02-05 00:41:13 +01:00
</span>