uci-hugo-doc/layouts/shortcodes/button.html

28 lines
575 B
HTML
Raw Permalink Normal View History

2022-06-11 08:46:13 -07:00
{{ $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
{{ with $ref }}href="{{ . }}"{{ end }}
{{ with $target }}target="{{ . }}"{{ end }}
class="gdoc-button__link"
>
{{ $.Inner }}
</a>
</span>