mirror of
https://github.com/adityatelange/hugo-PaperMod.git
synced 2023-12-21 10:22:58 +01:00
Show related posts
This commit is contained in:
parent
3a0a4811cb
commit
d6efc73123
@ -295,6 +295,18 @@
|
||||
margin-top: 56px;
|
||||
}
|
||||
|
||||
.post-footer h3 {
|
||||
margin: 2em 0 1.2em;
|
||||
}
|
||||
|
||||
.post-footer .related ul {
|
||||
padding-inline-start: 20px;
|
||||
}
|
||||
|
||||
.post-footer .related a:hover {
|
||||
box-shadow: 0 1px;
|
||||
}
|
||||
|
||||
.post-tags li {
|
||||
display: inline-block;
|
||||
margin-inline-end: 3px;
|
||||
|
@ -31,3 +31,6 @@
|
||||
|
||||
- id: code_copied
|
||||
translation: "copied!"
|
||||
|
||||
- id: related
|
||||
translation: "See also"
|
@ -31,3 +31,6 @@
|
||||
|
||||
- id: code_copied
|
||||
translation: "Copié !"
|
||||
|
||||
- id: related
|
||||
translation: "Voir aussi"
|
@ -36,6 +36,12 @@
|
||||
{{- end }}
|
||||
|
||||
<footer class="post-footer">
|
||||
|
||||
{{/* Show related posts */}}
|
||||
{{- if (.Param "ShowRelatedContent") }}
|
||||
{{- partial "related.html" . }}
|
||||
{{- end }}
|
||||
|
||||
{{- $tags := .Language.Params.Taxonomies.tag | default "tags" }}
|
||||
<ul class="post-tags">
|
||||
{{- range ($.GetTerms $tags) }}
|
||||
|
13
layouts/partials/related.html
Normal file
13
layouts/partials/related.html
Normal file
@ -0,0 +1,13 @@
|
||||
{{ $related := first 5 (where (where .Site.Pages ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" .Permalink) }}
|
||||
{{ with $related }}
|
||||
<div class="related">
|
||||
<h3 class="see-also">{{- i18n "related" -}}</h3>
|
||||
<ul>
|
||||
{{ range . }}
|
||||
<li>
|
||||
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</div>
|
||||
{{ end }}
|
Loading…
Reference in New Issue
Block a user