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 := . -}} |   {{- $page := . -}} | ||||||
|   {{- $url := "" -}} |   {{- $url := "" -}} | ||||||
|   {{- $anchor := "" -}} |   {{- $anchor := "" -}} | ||||||
|  |   {{- $title := "" -}} | ||||||
|   {{- if reflect.IsMap . -}} |   {{- if reflect.IsMap . -}} | ||||||
|     {{- $anchor = .anchor -}} |     {{- $anchor = .anchor -}} | ||||||
|     {{- $page = .page -}} |     {{- $page = .page -}} | ||||||
|  | 	{{- $title = .title -}} | ||||||
|   {{- end -}}   |   {{- end -}}   | ||||||
|   {{- if ne $anchor "" -}} |   {{- if ne $anchor "" -}} | ||||||
|     {{- $url = printf "%s#%v" $page.Permalink $anchor -}} |     {{- $url = printf "%s#%v" $page.Permalink $anchor -}} | ||||||
|   {{- else -}} |   {{- else -}} | ||||||
|     {{- $url = $page.Permalink -}} |     {{- $url = $page.Permalink -}} | ||||||
|   {{- end -}}   |   {{- end -}}   | ||||||
|   <a href="{{ $url }}">{{ $page.Title }}   |   <a href="{{ $url }}">{{ or $title $page.Title }}   | ||||||
|     {{ if $page.Date -}} |     {{ if $page.Date -}} | ||||||
|     <small>{{ $page.Date.Format (i18n "dateFormat") }}</small> |     <small>{{ $page.Date.Format (i18n "dateFormat") }}</small> | ||||||
|     {{- else if $page.Params.Teaser -}}<small>{{ $page.Params.Teaser }}</small> |     {{- else if $page.Params.Teaser -}}<small>{{ $page.Params.Teaser }}</small> | ||||||
|  |  | ||||||
|  | @ -10,7 +10,8 @@ | ||||||
|   {{- $url := printf "%s%s%s" .Permalink $fragsep $frag -}} |   {{- $url := printf "%s%s%s" .Permalink $fragsep $frag -}} | ||||||
|   {{- $text := or $inner .Title -}} |   {{- $text := or $inner .Title -}} | ||||||
|   {{- $anchor := printf "link-%d" $linkid -}} |   {{- $anchor := printf "link-%d" $linkid -}} | ||||||
|  |   {{- $title := printf "%s (%d)" $this.Title $linkid -}} | ||||||
|   <a id="{{ $anchor }}" |   <a id="{{ $anchor }}" | ||||||
|      href="{{ $url }}">{{ $text | markdownify }}</a> |      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 -}} | {{- end -}} | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue