jlelse
/
Indieroad
Archived
1
Fork 0
This repository has been archived on 2020-05-21. You can view files and clone it, but cannot push or open issues or pull requests.
Indieroad/layouts/partials/mentionedin.html

26 lines
898 B
HTML
Raw Normal View History

{{ if .Param "mentionedin" }}
{{ if in (.Site.Param "postSections" | default (slice "posts")) .Type }}
{{ $mentionedIn := slice }}
{{ $current := .RelPermalink }}
{{ range .Sites }}
{{ $allPages := ( where .RegularPages "Type" "in" (.Param "postSections" | default (slice "posts")) ) }}
{{ range $allPages }}
{{ if strings.Contains .RawContent $current }}
{{ $mentionedIn = $mentionedIn | append . }}
{{ end }}
{{ end }}
{{ end }}
{{ with $mentionedIn }}
<div class="mentionedin">
<details>
<summary class="mentionedin-caption">{{ T "mentionedin" }}</summary>
<ul class="mentionedin-list">
{{ range sort . "Date" "desc" }}
<li><a href="{{ .RelPermalink }}">{{ with .Title }}{{ . }}{{ else }}{{ .Summary | truncate 60 }}{{ end }}</a> <i>{{.Date.Format ( .Site.Params.dateformat | default "January 02, 2006")}}</i></li>
{{ end }}
</ul>
</details>
</div>
{{ end }}
{{ end }}
{{ end }}