'embed' shortcode: make title configurable and other improvements
This commit is contained in:
		
							parent
							
								
									0f05d22902
								
							
						
					
					
						commit
						6a84403aff
					
				
					 1 changed files with 7 additions and 5 deletions
				
			
		|  | @ -1,15 +1,17 @@ | ||||||
| {{- $pid := or (.Get "pid") (.Get "page") -}} | {{- $pid := or (.Get "pid") (.Get "page") -}} | ||||||
| {{- $this := $.Page -}} | {{- $this := $.Page -}} | ||||||
|  | {{- $title := .Get "title" -}} | ||||||
|  | {{- $noTitle := .Get "notitle" -}} | ||||||
| {{- $linkid := or ($this.Scratch.Get "linkid") 1 -}} | {{- $linkid := or ($this.Scratch.Get "linkid") 1 -}} | ||||||
| {{- $this.Scratch.Set "linkid" (add $linkid 1) -}} | {{- $this.Scratch.Set "linkid" (add $linkid 1) -}} | ||||||
| {{- $pages := where .Site.RegularPages "Params.pageid" "eq" $pid -}} | {{- $pages := where .Site.RegularPages "Params.pageid" "eq" $pid -}} | ||||||
| {{- $btext := or (.Get "btext") (printf "%d" $linkid) -}} | {{- $btext := or (.Get "btext") (printf "%d" $linkid) -}} | ||||||
| {{- $btitle := .Get "btitle" -}} | {{- $btitle := .Get "btitle" -}} | ||||||
| 
 | {{- $anchor := printf "link-%d" $linkid -}} | ||||||
| {{- range $pages -}} | {{- range $pages -}} | ||||||
|   {{- $anchor := anchorize .Title -}} |   {{- if ne $title "none" -}} | ||||||
|  | ### [{{ or $title .Title }}]({{ .Permalink }}) {#{{ $anchor }}} | ||||||
|     {{- .Scratch.Add "backlinks" (slice (dict "anchor" $anchor "page" $this "btext" $btext "btitle" $btitle)) -}} |     {{- .Scratch.Add "backlinks" (slice (dict "anchor" $anchor "page" $this "btext" $btext "btitle" $btitle)) -}} | ||||||
| ### [{{ .Title }}]({{ .Permalink }}) |   {{- end -}} | ||||||
| 
 |  | ||||||
|   {{ .RenderShortcodes }} |   {{ .RenderShortcodes }} | ||||||
| {{- end -}} | {{- end -}} | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue