main
html 8 lines 588 Bytes
Raw
1 {{- $destination := .Destination -}}
2 {{- $isWeeklyRepo := and (eq .Page.Type "weekly") (hasPrefix $destination "https://github.com/") -}}
3 {{- $repoName := "" -}}
4 {{- if $isWeeklyRepo -}}
5 {{- $repoName = replaceRE `^https://github\.com/([^/#?]+/[^/#?]+).*$` "$1" $destination -}}
6 {{- if eq $repoName $destination -}}{{- $isWeeklyRepo = false -}}{{- end -}}
7 {{- end -}}
8 <a href="{{ $destination | safeURL }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if $isWeeklyRepo }} class="repo-inline-link" aria-label="Open GitHub repository {{ $repoName }}"{{ end }}>{{ .Text | safeHTML }}</a>