links with titles; comment shortcode; page-level control for some sidebar entries
This commit is contained in:
		
							parent
							
								
									46dec4788f
								
							
						
					
					
						commit
						1b4715b6cc
					
				
					 6 changed files with 15 additions and 13 deletions
				
			
		|  | @ -1,5 +1,3 @@ | ||||||
| {{- if hasPrefix .Destination "https://" -}} |   <a {{ with .Title }}title="{{ . }}" {{ end -}} | ||||||
|   <a href="{{ .Destination }}" target="_blank">{{ .Text }}</a> | 	 {{ if hasPrefix .Destination "https://" }}target="_blank" {{ end -}} | ||||||
| {{- else -}} | 	 href="{{ .Destination }}">{{ .Text }}</a> | ||||||
|   <a href="{{ .Destination }}">{{ .Text }}</a> |  | ||||||
| {{- end -}} |  | ||||||
|  |  | ||||||
|  | @ -2,11 +2,11 @@ | ||||||
| {{- $showChildren := .Param "showChildArticles" -}} | {{- $showChildren := .Param "showChildArticles" -}} | ||||||
| {{- $children := slice -}} | {{- $children := slice -}} | ||||||
| {{- if $showChildren -}} | {{- if $showChildren -}} | ||||||
|   {{- $children = .Site.RegularPages.RelatedTo (keyVals "parents" .Params.pageid) -}} |   {{- $children = .Site.Pages.RelatedTo (keyVals "parents" .Params.pageid) -}} | ||||||
| {{- end -}} | {{- end -}} | ||||||
|  | {{- $mainwidth := or (and .Params.noSidebar "12") "8" -}} | ||||||
| 
 | 
 | ||||||
| <div class="row"> | <div class="row"> | ||||||
|   {{- $mainwidth := or (and .Params.noSidebar "12") "8" -}} |  | ||||||
|   <div class="col-md-{{ $mainwidth }}"> |   <div class="col-md-{{ $mainwidth }}"> | ||||||
|     <article class="card mt-3 mb-3"  |     <article class="card mt-3 mb-3"  | ||||||
|              itemscope itemtype="http://schema.org/BlogPosting"> |              itemscope itemtype="http://schema.org/BlogPosting"> | ||||||
|  |  | ||||||
|  | @ -75,7 +75,7 @@ | ||||||
|         (dict "related" $related "header" (i18n "parent-articles") "id" "parents") -}} |         (dict "related" $related "header" (i18n "parent-articles") "id" "parents") -}} | ||||||
|   {{- end -}} |   {{- end -}} | ||||||
| 
 | 
 | ||||||
|   {{- if and (not .Site.Params.hideChildArticles) |   {{- if and (not (.Param "hideChildArticles")) | ||||||
|              (ne .Site.Params.showChildArticles "cards") -}} |              (ne .Site.Params.showChildArticles "cards") -}} | ||||||
|     {{- $related :=  .Site.Pages.RelatedTo (keyVals "parents" .Params.pageid) -}} |     {{- $related :=  .Site.Pages.RelatedTo (keyVals "parents" .Params.pageid) -}} | ||||||
|     {{- partial "card-related"  |     {{- partial "card-related"  | ||||||
|  | @ -90,7 +90,7 @@ | ||||||
| 		 "header" (i18n "related-articles") "id" "related") -}} | 		 "header" (i18n "related-articles") "id" "related") -}} | ||||||
|   {{- end -}} |   {{- end -}} | ||||||
| 
 | 
 | ||||||
|   {{- if not .Site.Params.hideSiblingArticles -}} |   {{- if not (.Param "hideSiblingArticles") -}} | ||||||
|     {{- $related :=  .Site.Pages.RelatedIndices . "parents" -}} |     {{- $related :=  .Site.Pages.RelatedIndices . "parents" -}} | ||||||
|     {{- partial "card-related"  |     {{- partial "card-related"  | ||||||
|         (dict "related" $related.ByWeight  |         (dict "related" $related.ByWeight  | ||||||
|  |  | ||||||
							
								
								
									
										1
									
								
								layouts/shortcodes/comment.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								layouts/shortcodes/comment.html
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | ||||||
|  | {{- if .Inner -}}{{- end -}} | ||||||
|  | @ -1,10 +1,12 @@ | ||||||
| {{- $pid := or (.Get "pid") (.Get "page") -}} | {{- $pid := or (.Get "pid") (.Get "page") -}} | ||||||
| {{- $this := $.Page -}} | {{- $this := $.Page -}} | ||||||
| {{- $title := .Get "title" -}} | {{- $title := .Get "title" -}} | ||||||
|  | {{- $summary := .Get "summary" -}} | ||||||
|  | {{- $prefix := .Get "prefix" | default "#####" -}} | ||||||
| {{- $pages := where .Site.RegularPages "Params.pageid" "eq" $pid -}} | {{- $pages := where .Site.RegularPages "Params.pageid" "eq" $pid -}} | ||||||
| {{- range $pages -}} | {{- range $pages -}} | ||||||
|   {{- if ne $title "none" -}} |   {{- if ne $title "none" -}} | ||||||
| ### [{{ or $title .Title }}]({{ .Permalink }})  | {{ $prefix }} [{{ or $title .Title }}]({{ .Permalink }} "{{ or $summary .Summary }}")  | ||||||
|   {{- end -}} |   {{- end -}} | ||||||
|   {{ .RenderShortcodes }} |   {{ .RenderShortcodes }} | ||||||
| {{- end -}} | {{- end -}} | ||||||
|  |  | ||||||
|  | @ -3,16 +3,17 @@ | ||||||
| {{- $this := $.Page -}} | {{- $this := $.Page -}} | ||||||
| {{- $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.Pages "Params.pageid" "eq" $pid -}} | ||||||
| {{- $fragsep := cond (eq $frag "") "" "#" -}} | {{- $fragsep := cond (eq $frag "") "" "#" -}} | ||||||
| {{- $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 -}} | {{- $anchor := printf "link-%d" $linkid -}} | ||||||
| {{- $inner := .Inner -}} | {{- $inner := .Inner -}} | ||||||
|  | {{- $linkTitle := (.Get "title") -}} | ||||||
| {{- range $pages -}} | {{- range $pages -}} | ||||||
|   {{- $url := printf "%s%s%s" .Permalink $fragsep $frag -}} |   {{- $url := printf "%s%s%s" .Permalink $fragsep $frag -}} | ||||||
|   {{- $text := or $inner .Title -}} |   {{- $text := or $inner .Title -}} | ||||||
|   <a id="{{ $anchor }}"  |   <a id="{{ $anchor }}"{{ with $linkTitle }} title="{{ . }}"{{ end }} | ||||||
|      href="{{ $url }}">{{ $text | markdownify }}</a> |      href="{{ $url }}">{{ $text | markdownify }}</a> | ||||||
|   {{- .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)) -}} | ||||||
| {{- end -}} | {{- end -}} | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue