hugo-geekblog/layouts/shortcodes/button.html

30 lines
609 B
HTML
Raw Permalink Normal View History

{{- $ref := "" }}
{{- $class := "" }}
{{- $size := default "regular" (.Get "size" | lower) }}
{{- if not (in (slice "regular" "large") $size) }}
{{- $size = "regular" }}
{{- end }}
2020-07-06 18:55:32 +00:00
{{- with .Get "href" }}
{{- $ref = . }}
{{- end }}
2020-07-06 18:55:32 +00:00
{{- with .Get "relref" }}
{{- $ref = relref $ . }}
{{- end }}
2020-07-06 18:55:32 +00:00
{{- with .Get "class" }}
{{- $class = . }}
{{- end }}
<span class="gblog-button gblog-button--{{ $size }}{{ with $class }}{{ printf " %s" . }}{{ end }}">
<a
class="gblog-button__link"
{{- with $ref }}{{ printf " href=\"%s\"" . | safeHTMLAttr }}{{ end }}
>
{{ $.Inner }}
</a>
2020-07-06 18:55:32 +00:00
</span>