Add option to show list of articles which mention article
This commit is contained in:
parent
915e216f69
commit
a5ce0e459d
|
@ -779,7 +779,7 @@ select {
|
|||
}
|
||||
|
||||
/* Related articles and webmentions */
|
||||
.related, .mentions {
|
||||
.related, .mentions, .mentionedin {
|
||||
@include subarticle-element;
|
||||
@media screen and (max-width: $break1) {
|
||||
min-width: 100%;
|
||||
|
|
|
@ -66,3 +66,6 @@
|
|||
|
||||
- id: stopspeak
|
||||
translation: Hör auf zu sprechen!
|
||||
|
||||
- id: mentionedin
|
||||
translation: Erwähnt in
|
|
@ -69,3 +69,6 @@
|
|||
|
||||
- id: stopspeak
|
||||
translation: Stop speaking!
|
||||
|
||||
- id: mentionedin
|
||||
translation: Mentioned in
|
|
@ -22,6 +22,7 @@
|
|||
</div>
|
||||
{{ partial "post_tags" . }}
|
||||
</article>
|
||||
{{ partial "mentionedin.html" . }}
|
||||
{{ if (.Param "authorbox") }}{{ partialCached "authorbox" . }}{{ end }}
|
||||
</main>
|
||||
{{ if (and (.Param "promo") .CurrentSection.Parent) }}{{ partialCached "promo" . }}{{ end }}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
{{ 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 }}
|
Reference in New Issue