backlinks: show link number
This commit is contained in:
		
							parent
							
								
									29ef9cc5ca
								
							
						
					
					
						commit
						f56dbfd3a9
					
				
					 2 changed files with 5 additions and 2 deletions
				
			
		|  | @ -3,16 +3,18 @@ | |||
|   {{- $page := . -}} | ||||
|   {{- $url := "" -}} | ||||
|   {{- $anchor := "" -}} | ||||
|   {{- $title := "" -}} | ||||
|   {{- if reflect.IsMap . -}} | ||||
|     {{- $anchor = .anchor -}} | ||||
|     {{- $page = .page -}} | ||||
| 	{{- $title = .title -}} | ||||
|   {{- end -}}   | ||||
|   {{- if ne $anchor "" -}} | ||||
|     {{- $url = printf "%s#%v" $page.Permalink $anchor -}} | ||||
|   {{- else -}} | ||||
|     {{- $url = $page.Permalink -}} | ||||
|   {{- end -}}   | ||||
|   <a href="{{ $url }}">{{ $page.Title }}   | ||||
|   <a href="{{ $url }}">{{ or $title $page.Title }}   | ||||
|     {{ if $page.Date -}} | ||||
|     <small>{{ $page.Date.Format (i18n "dateFormat") }}</small> | ||||
|     {{- else if $page.Params.Teaser -}}<small>{{ $page.Params.Teaser }}</small> | ||||
|  |  | |||
|  | @ -10,7 +10,8 @@ | |||
|   {{- $url := printf "%s%s%s" .Permalink $fragsep $frag -}} | ||||
|   {{- $text := or $inner .Title -}} | ||||
|   {{- $anchor := printf "link-%d" $linkid -}} | ||||
|   {{- $title := printf "%s (%d)" $this.Title $linkid -}} | ||||
|   <a id="{{ $anchor }}" | ||||
|      href="{{ $url }}">{{ $text | markdownify }}</a> | ||||
|   {{- .Scratch.Add "backlinks" (slice (dict "anchor" $anchor "page" $this)) -}} | ||||
|   {{- .Scratch.Add "backlinks" (slice (dict "anchor" $anchor "page" $this "title" $title)) -}} | ||||
| {{- end -}} | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue