My personal Hugo theme
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

26 lines
898 B

{{ 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 }}