54 lines
1.7 KiB
HTML
54 lines
1.7 KiB
HTML
{{ $currtitle := .Title }}
|
|
{{ $currRellink := substr .RelPermalink 0 -1 }}
|
|
{{ $currContent := .Content }}
|
|
|
|
{{ $backlinks := slice }}
|
|
{{ $forwardlinks := slice }}
|
|
{{ range (where (where .Site.Pages.ByDate.Reverse ".Section" "in" (slice "post")) ".Params.disableComments" "!=" "true") }}
|
|
|
|
{{ $found := findRE $currRellink .Content 1 }}
|
|
{{ if and ($found) (ne .Title $currtitle) }}
|
|
{{ $backlinks = $backlinks | append . }}
|
|
{{ else }}
|
|
{{ $rellink := substr .RelPermalink 0 -1 }}
|
|
{{ $found = findRE $rellink $currContent 1 }}
|
|
{{ if and ($found) (ne .Title $currtitle) }}
|
|
{{ $forwardlinks = $forwardlinks | append . }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ $tagslice := first 5 (where (where .Site.RegularPages.ByDate.Reverse ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" .Permalink) }}
|
|
|
|
{{ $related := append $tagslice $forwardlinks }}
|
|
{{ $related = append $related $backlinks }}
|
|
|
|
|
|
{{ if $related }}
|
|
<h3 class="page-header" id="related">
|
|
<a href="#related">
|
|
<svg class='icon icon-text' width='24' height='24'>
|
|
<title>Related articles</title>
|
|
<use xlink:href='#news'></use>
|
|
</svg>
|
|
</a>
|
|
You Might Also Like...
|
|
</h3>
|
|
|
|
<article>
|
|
<ul class="small">
|
|
{{ range first 7 $related | uniq }}
|
|
<li class="flexgrid flexgrid-8020" style="padding-bottom: 0.5rem">
|
|
<span>
|
|
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
|
|
</span>
|
|
<small>
|
|
<time datetime='{{ .Date.Format "2006-01-02" }}'>
|
|
{{ .Date.Format (.Site.Params.dateFormat | default "02 Jan 2006") }}
|
|
</time>
|
|
</small>
|
|
</li>
|
|
{{ end }}
|
|
</ul>
|
|
</article>
|
|
{{ end }}
|