aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/_default/single.html
blob: f3123b3e15a9d150159ddac369c56922d010cf76 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
{{- define "styles" -}}
<style>
  {{ partial "navigator.css.html" (dict "Link" "/") | safeCSS }}
</style>
{{- end -}}

{{- define "header" -}}
  {{- partial "navigator-middle.html"
    (dict
      "Title"      "Post"
      "Subtitle"   "Thread"
      "Icon"       "arrow-left"
      "IconLabel"  "Back"
      "Href"       "/"
      "Id"         "back"
      "Context"    .
    )
  -}}
{{- end -}}

{{- define "middle" -}}
  <micro-thread>
    {{- partial "render-embed.html" . -}}

    {{- $prevHref  := "/" -}}
    {{- $nextHref  := "/" -}}
    {{- $prevTitle := "hidden" -}}
    {{- $nextTitle := "hidden" -}}

    {{- with .Next -}}
      {{- $nextHref = $.Next.Permalink -}}
      {{- $nextTitle = $.Next.Summary -}}
    {{- end -}}

    {{- with .Prev -}}
      {{- $prevHref = $.Prev.Permalink -}}
      {{- $prevTitle = $.Prev.Summary -}}
    {{- end -}}

    {{- with or .Next .Prev -}}
      <nav data-type="pagination">
        <a rel="next" href="{{ $nextHref }}" title="{{ $nextTitle }}">
          {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/arrow-left.svg")) }}
          <header>Newer</header>
        </a>

        <a rel="prev" href="{{ $prevHref }}" title="{{ $prevTitle }}">
          <header>Older</header>
          {{ safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/arrow-right.svg")) }}
        </a>
      </nav>
    {{- end -}}

    {{- $filteredPages := partial "function-filters-content.html" (.Site.RegularPages.Related .) -}}
    {{- $related := $filteredPages | first 3 -}}

    {{- with $related -}}
      <related-content>
        <footer>
          <samp>
          Related Tags
          {{- with $.Params.tags -}}
            {{- range $tag := first 1 $.Params.tags -}}
              {{- $link := print ("tags/" | relURL) ($tag | urlize) "/" }}
              {{ print "---" " " "[#" $tag "](" $link ")" | markdownify -}}
            {{- end -}}
          {{- end -}}
          </samp>
        </footer>
      </related-content>

      {{- range $related -}}
        {{- partial "render-embed.html" . -}}
      {{- end -}}
    {{- end -}}
  </micro-thread>
{{- end -}}

{{- define "right" -}}
  {{- partial "navigator-right.html" . -}}
{{- end -}}