summaryrefslogtreecommitdiff
path: root/themes/hugo-coder/layouts/partials/posts/series.html
blob: d08a83d2ca8661213b451e6665dc33ca1acf4b92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{{ $currentPageUrl := .RelPermalink }}
{{ if .Params.series }}
<section class="see-also">
  {{ range .Params.series }}
    {{ $name := . | urlize }}
    {{ $series := index $.Site.Taxonomies.series $name }}
    {{ if gt (len $series.Pages) 1 }}
      <h3 id="{{ i18n "see_also" | default "See also in" | anchorize }}-{{ anchorize . | safeURL }}">
        {{ i18n "see_also" | default "See also in" }} {{ . }}
        <a class="heading-link" href="#{{ i18n "see_also" | default "See also in" | anchorize }}-{{ anchorize . | safeURL }}">
          <i class="fa fa-link" aria-hidden="true"></i>
        </a>
      </h3>
      <nav>
        <ul>
        {{ $maxItems := $.Site.Params.maxSeeAlsoItems | default 5 }}
        {{ range first (add $maxItems 1) $series.Pages }}
          {{ if ne .RelPermalink $currentPageUrl }}
            <li>
              <a href="{{ .Params.externalLink | default .RelPermalink }}">{{ .Title }}</a>
            </li>
          {{ end }}
        {{ end }}
        </ul>
      </nav>
    {{ end }}
  {{ end }}
</section>
{{ end }}