show backlinks to ilink shortcodes (if showBacklinks site param is set
This commit is contained in:
		
							parent
							
								
									a894b5f70d
								
							
						
					
					
						commit
						7729d0a132
					
				
					 5 changed files with 24 additions and 9 deletions
				
			
		|  | @ -1,5 +1,5 @@ | ||||||
| # | # | ||||||
| # de.yaml 2022-01-06 | # de.yaml 2022-01-08 | ||||||
| # | # | ||||||
| 
 | 
 | ||||||
| about: | about: | ||||||
|  | @ -20,6 +20,9 @@ articles-in-section: | ||||||
| author: | author: | ||||||
|   other: Autor |   other: Autor | ||||||
| 
 | 
 | ||||||
|  | backlinks: | ||||||
|  |   other: Verlinkte Seiten | ||||||
|  | 
 | ||||||
| child-articles: | child-articles: | ||||||
|   other: Untergeordnete Artikel |   other: Untergeordnete Artikel | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| # | # | ||||||
| # en.yaml 2022-01-06 | # en.yaml 2022-01-08 | ||||||
| # | # | ||||||
| 
 | 
 | ||||||
| about: | about: | ||||||
|  | @ -20,6 +20,9 @@ articles-in-section: | ||||||
| author: | author: | ||||||
|   other: Author |   other: Author | ||||||
| 
 | 
 | ||||||
|  | backlinks: | ||||||
|  |   other: Backlinks | ||||||
|  | 
 | ||||||
| child-articles: | child-articles: | ||||||
|   other: Child Articles |   other: Child Articles | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,6 +1,10 @@ | ||||||
| {{ range . -}} | {{ range $idx, $page := . -}} | ||||||
| <li> | <li> | ||||||
|   <a href="{{ .Permalink }}" |   {{- $url := .Permalink -}} | ||||||
|  |   {{- if eq (printf "%T" $idx) "string" -}} | ||||||
|  |     {{- $url = printf "%s#%v" .Permalink $idx -}} | ||||||
|  |   {{- end -}} | ||||||
|  |   <a href="{{ $url }}" | ||||||
|      class="text-decoration-none">{{ .Title }}   |      class="text-decoration-none">{{ .Title }}   | ||||||
|     {{ if .Date -}} |     {{ if .Date -}} | ||||||
|     <small>{{ .Date.Format (i18n "dateFormat") }}</small> |     <small>{{ .Date.Format (i18n "dateFormat") }}</small> | ||||||
|  |  | ||||||
|  | @ -69,6 +69,12 @@ | ||||||
|             (dict "related" $related "header" $header "id" "articles-in-section") -}} |             (dict "related" $related "header" $header "id" "articles-in-section") -}} | ||||||
|     {{- end }} |     {{- end }} | ||||||
| 
 | 
 | ||||||
|  |     {{ if .Site.Params.showBacklinks -}} | ||||||
|  |       {{- $related := .Scratch.Get "backlinks" -}} | ||||||
|  |       {{- partial "card-related"  | ||||||
|  |           (dict "related" $related "header" (i18n "backlinks") "id" "backlinks") -}} | ||||||
|  |     {{- end }} | ||||||
|  | 
 | ||||||
|     {{ if .Params.toc -}} |     {{ if .Params.toc -}} | ||||||
|     <div class="card mt-3"> |     <div class="card mt-3"> | ||||||
|       <div class="card-header"> |       <div class="card-header"> | ||||||
|  |  | ||||||
|  | @ -6,9 +6,8 @@ | ||||||
| {{- $inner := .Inner -}} | {{- $inner := .Inner -}} | ||||||
| {{- range $pages -}} | {{- range $pages -}} | ||||||
|   {{- $url := printf "%s%s%s" .Permalink $fragsep $frag -}} |   {{- $url := printf "%s%s%s" .Permalink $fragsep $frag -}} | ||||||
|   <a id="{{ .Params.pageid }}" |   {{- $text := or $inner .Title -}} | ||||||
|      anchor="{{ .Params.pageid }}" |   <a id="{{ $text | anchorize }}" | ||||||
|      href="{{ $url }}">{{ or $inner .Title | markdownify }}</a> |      href="{{ $url }}">{{ $text | markdownify }}</a> | ||||||
|   {{- $backlink := printf "%s#%s" $this.Permalink .Params.pageid -}} |   {{- .Scratch.SetInMap "backlinks" (anchorize $text) $this -}} | ||||||
|   {{- .Scratch.Add "backlinks" (slice $this) -}} |  | ||||||
| {{- end -}} | {{- end -}} | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue