backlinks: provide additional parameter btitle
This commit is contained in:
		
							parent
							
								
									76244a73da
								
							
						
					
					
						commit
						9051375a03
					
				
					 2 changed files with 7 additions and 6 deletions
				
			
		|  | @ -4,19 +4,19 @@ | |||
|   {{- $url := "" -}} | ||||
|   {{- $anchor := "" -}} | ||||
|   {{- $btext := "" -}} | ||||
|   {{- $btitle := "" -}} | ||||
|   {{- if reflect.IsMap . -}} | ||||
|     {{- $anchor = .anchor -}} | ||||
|     {{- $page = .page -}} | ||||
| 	{{- with .btext -}} | ||||
| 	  {{- $btext = printf " (%s)" . -}} | ||||
| 	{{- end -}} | ||||
| 	{{- with .btext -}}{{- $btext = printf " (%s)" . -}}{{- end -}} | ||||
| 	{{- $btitle = .btitle -}} | ||||
|   {{- end -}}   | ||||
|   {{- if ne $anchor "" -}} | ||||
|     {{- $url = printf "%s#%v" $page.Permalink $anchor -}} | ||||
|   {{- else -}} | ||||
|     {{- $url = $page.Permalink -}} | ||||
|   {{- end -}} | ||||
|   <a href="{{ $url }}">{{ $page.Title }}{{ $btext }}   | ||||
|   <a href="{{ $url }}" title="{{ $btitle }}">{{ $page.Title }}{{ $btext }}   | ||||
|     {{ if $page.Date -}} | ||||
|     <small>{{ $page.Date.Format (i18n "dateFormat") }}</small> | ||||
|     {{- else if $page.Params.Teaser -}}<small>{{ $page.Params.Teaser }}</small> | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ | |||
| {{- $pages := where .Site.RegularPages "Params.pageid" "eq" $pid -}} | ||||
| {{- $fragsep := cond (eq $frag "") "" "#" -}} | ||||
| {{- $btext := or (.Get "btext") (printf "%d" $linkid) -}} | ||||
| {{- $btitle := .Get "btitle" -}} | ||||
| {{- $anchor := printf "link-%d" $linkid -}} | ||||
| {{- $inner := .Inner -}} | ||||
| {{- range $pages -}} | ||||
|  | @ -13,5 +14,5 @@ | |||
|   {{- $text := or $inner .Title -}} | ||||
|   <a id="{{ $anchor }}"  | ||||
|      href="{{ $url }}">{{ $text | markdownify }}</a> | ||||
|   {{- .Scratch.Add "backlinks" (slice (dict "anchor" $anchor "page" $this "btext" $btext)) -}} | ||||
|   {{- .Scratch.Add "backlinks" (slice (dict "anchor" $anchor "page" $this "btext" $btext "btitle" $btitle)) -}} | ||||
| {{- end -}} | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue