14 lines
		
	
	
	
		
			583 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			14 lines
		
	
	
	
		
			583 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
| {{- $pid := or (.Get "pid") (.Get "page") -}}
 | |
| {{- $frag := or (.Get "id") (.Get "anchor") -}}
 | |
| {{- $this := $.Page -}}
 | |
| {{- $pages := where .Site.RegularPages "Params.pageid" "eq" $pid -}}
 | |
| {{- $fragsep := cond (eq $frag "") "" "#" -}}
 | |
| {{- $inner := .Inner -}}
 | |
| {{- range $pages -}}
 | |
|   {{- $url := printf "%s%s%s" .Permalink $fragsep $frag -}}
 | |
|   {{- $text := or $inner .Title -}}
 | |
|   {{- $anchor := $text | anchorize -}}
 | |
|   <a id="{{ $anchor }}"
 | |
|      href="{{ $url }}">{{ $text | markdownify }}</a>
 | |
|   {{- .Scratch.Add "backlinks" (slice (dict "anchor" $anchor "page" $this)) -}}
 | |
| {{- end -}}
 |