docs/layouts/shortcodes/button.html

15 lines
537 B
HTML

{{ $text := .Get "text" }}
{{ $url := .Get "url" }}
{{- if (strings.HasPrefix $url "http") -}}
{{ $url = $url | safeURL }}
{{- else if (strings.FindRE `([^_]|^)index.md` $url 1) -}}
{{ $url = ref .Page (strings.Replace $url "index.md" "_index.md") }}
{{- else -}}
{{ $url = ref .Page $url }}
{{- end -}}
<div class="not-prose my-4">
<a href="{{ $url }}"
class="cursor-pointer py-2 px-4 rounded bg-blue-light-500 dark:bg-blue-dark-400 hover:bg-blue-light-400 dark:hover:bg-blue-dark-500 text-white">{{
$text }}</a>
</div>