hugo-theme-paradox/layouts/shortcodes/section-ref.html

22 lines
714 B
HTML

{{- $ref := relref . (.Get "ref") }}
{{- $path := (index (split (.Get "ref") "#") 0) }}
{{- $anchor := (index (split (.Get "ref") "#") 1)}}
{{- $page := .Site.GetPage $path -}}
{{- with $page -}}
<a href="{{ $ref }}" class="ref-link section-ref">
<div class="ref-link__icon">
{{ if $.Get "icon" }}
{{ $.Get "icon" | safeHTML }}
{{ else }}
<svg xmlns="http://www.w3.org/2000/svg" fill="none" height="24" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" d="M13.5 4.5L21 12m0 0l-7.5 7.5M21 12H3" />
</svg>
{{ end }}
</div>
<div class="ref-link__text">
<span class="section-ref__title">
{{- or ($.Get "title") .Title }}
</span>
</div>
</a>
{{- end -}}