aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/_default/section.media.html
blob: 420035b406cf3e372a52908144b520b08d34bc18 (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
{{- define "styles" -}}
{{- $author := partial "function-authors-data.html" . -}}
{{- $author = $author.user -}}
<style>
  {{ partial "styles-navigator.html" (dict "Link" "/") | safeCSS }}

  tab-bar a[href="{{ .Site.BaseURL }}/{{ $author }}/media/"] {
    color: #111;
    color: var(--foreground);
    display: inherit;
    font-weight: 700;
    text-decoration-color: #014cc6;
    text-decoration-color: var(--link);
    text-decoration: underline;
  }
</style>
{{- end -}}

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

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

  {{- $author := partial "function-authors-data.html" . -}}
  {{- $author = $author.user -}}

  {{- $count  := 0     -}}
  {{- $result := false -}}

  {{- range .Site.RegularPages -}}
    {{- if or
      (in .Content "<figure>")
      (in .Content "<imgur-video>")
      (in .Content "<youtube-video>")
      (in .Content "<video-container>")
    -}}
     {{- if eq .Type $author -}}
      {{- $result = true -}}
      {{- $count = add $count 1 -}}
      {{- if le $count 10 -}}
        {{- partial "render-embed.html" . -}}
      {{- end -}}
     {{- end -}}
    {{- end -}}
  {{- end -}}

  {{- if not $result -}}
  <footer>
    <code>No media found!</code>
  </footer>
  {{- end -}}

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

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