aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/_default/section.media.html
blob: 02b50b3d699cbe7fd6301551bb465c2307b9e47a (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
{{- define "styles" -}}
  <style>
    {{ partial "navigator.css.html" (dict "Link" "/")                  | safeCSS }}
    {{ partial "tabbar.css.html"    (dict "Context" . "Hash" "#media") | safeCSS }}
  </style>
{{- end -}}

{{- define "header" -}}
  {{- partial "navigator-middle.html"
    (dict
      "Title"      "Media"
      "Subtitle"   (print (partial "count-media.html" .) " " "Total")
      "Icon"       "arrow-left"
      "IconLabel"  "Back"
      "Href"       ("" | relURL)
      "Id"         "back"
      "Context"    .
    )
  -}}

  {{- partial "profile.html" . -}}
{{- end -}}

{{- define "middle" -}}
  {{- $author := .Section -}}
  {{- $notFeeds := where .Site.RegularPages "Params.feed" "eq" nil -}}
  {{- $authors := where .Site.RegularPages "Section" $author -}}
  {{- $filteredPages := $authors | intersect $notFeeds -}}
  {{- $count := 0 -}}

  {{- range first 100 $filteredPages -}}
    {{- if eq $count 10 -}}
      {{- break -}}
    {{- end -}}
    {{- if or
      (in .Content "</video>")
      (in .Content "</picture>")
      (in .Content "</youtube-video>")
    -}}
      {{- partial "render-embed.html" . -}}
      {{- $count = add $count 1 -}}
    {{- end -}}
  {{- end -}}

  {{- if not $count -}}
  <footer>
    <code>No items found!</code>
  </footer>
  {{- end -}}
{{- end -}}

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