uci-hugo-landingpage/layouts/shortcodes/link.html

25 lines
1.0 KiB
HTML

{{ .Scratch.Set "url" (.Get "url") }}
{{ .Scratch.Set "height" (.Get "height") }}
{{ .Scratch.Set "width" (.Get "width" | default "1000") }}
{{ if .Get "height" }}
{{ .Scratch.Set "height" ( printf ", height=%s" ( .Scratch.Get "height" ) ) }}
{{else}}
{{ .Scratch.Set "height" "" }}
{{ end }}
{{ if eq (.Get "display") "window" }}
{{ .Scratch.Set "url" ( printf "javascript:void( window.open('%s', 'blank', 'scrollbars=yes, toolbar=no, width=%s %s' ))" (.Scratch.Get "url") (.Scratch.Get "width") (.Scratch.Get "height") ) }}
{{ end }}
<a
{{ if eq (.Get "display") "tab" }} target="_blank"{{ end }}
{{ if eq (.Get "display") "modal" }} modal{{ end }}
{{ if eq (.Get "type") "btn" }} class="box box--btn btn btn--{{ .Get "size" | default "regular" }}"{{ end }}
{{ printf "href=%q" (.Scratch.Get "url") | safeHTMLAttr }}
>
{{ with .Get "icon" }}<i class="btn__icon fa fa-{{ . }}"></i>{{ end }}
{{ if eq (.Get "type") "btn" }}<div class="btn__text">{{ .Get "text" }}</div>
{{ else }}
{{ .Get "text" }}
{{ end }}
</a>