2025-04-18 12:05:39 +02:00
|
|
|
|
{{- $currentPage := .Page -}}
|
2025-04-20 00:01:16 +02:00
|
|
|
|
{{- $text := .Text -}}
|
|
|
|
|
{{- $destination := .Destination -}}
|
|
|
|
|
|
|
|
|
|
{{- $u := urls.Parse $destination -}}
|
2025-04-18 12:05:39 +02:00
|
|
|
|
{{- if not $u.Scheme -}}
|
|
|
|
|
{{- with site.GetPage .Destination -}}
|
|
|
|
|
{{- $backlinks := .Store.Get "backlinks" | default slice -}}
|
|
|
|
|
{{- $backlinks := $backlinks|append $currentPage.RelPermalink -}}
|
|
|
|
|
{{- .Store.Set "backlinks" ($backlinks|uniq) -}}
|
2025-04-20 00:01:16 +02:00
|
|
|
|
{{- if not $text -}}
|
|
|
|
|
{{- $text = .LinkTitle -}}
|
|
|
|
|
{{- end -}}
|
|
|
|
|
<span class="supt">{{- .Section -}}⁄</span><a href="{{- .RelPermalink -}}" {{- with .Title }} title="{{ . }}"{{ end -}}>{{- $text -}}</a>
|
2025-04-18 12:05:39 +02:00
|
|
|
|
{{- end -}}
|
2025-04-20 00:01:16 +02:00
|
|
|
|
{{- if hasPrefix $destination "/library" -}}
|
|
|
|
|
{{- $bib := strings.TrimPrefix "/library/" $destination -}}
|
|
|
|
|
{{- $b := index site.Data.books.catalog $bib -}}
|
|
|
|
|
{{- if not $text -}}
|
|
|
|
|
{{- $text = $b.title|default "" -}}
|
|
|
|
|
{{- end -}}
|
|
|
|
|
<span class="supt">library⁄</span><a href="/library/BROWSE_LIBRARY.html#/books/{{- $bib -}}">{{- $text -}}</a>
|
|
|
|
|
{{- end -}}
|
|
|
|
|
{{- else -}}
|
|
|
|
|
<span class="supt">www⁄</span><a href="{{ .Destination | safeURL }}"{{- with .Title }} title="{{ . }}"{{ end -}}{{- if $u.IsAbs }} rel="external"{{ end -}}>{{- with .Text }}{{ . }}{{- end -}}</a>
|
2025-04-18 12:05:39 +02:00
|
|
|
|
{{- end -}}
|
|
|
|
|
{{- /* chomp trailing newline */ -}}
|