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

16 lines
657 B
HTML
Raw Permalink Normal View History

2022-12-19 15:10:26 +00:00
{{- with .Get "url" -}}
{{ $filename := replaceRE `.*/blob/.+/(.*)` "$1" . }}
{{ $path := replaceRE `.*/blob/.*?/(.*)` "$1" . }}
<a href="{{ . }}" class="ref-link source-ref">
<div class="ref-link__icon">
<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="M17.25 6.75L22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3l-4.5 16.5" />
</svg>
</div>
<div class="ref-link__text">
<span class="source-ref__name">{{- or ($.Get "name") $filename }}</span>
<br>
<span class="source-ref__path">{{ $path }}</span>
</div>
</a>
{{- end -}}