aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/partials/following-list.html
blob: d6384879c861ff1c604fcf87ce4c54913d11e2ec (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
{{- $unique    := slice -}}
{{- $following := slice -}}

{{- range (where .Site.Pages "Params.Author" (partial "author-user.html" .)) -}}
  {{- if .Params.feed -}}
    {{-
      $following = $following | append (dict
        "Domain" .Params.feed.domain
        "Name"   .Params.feed.name
      )
    -}}
    {{-
      $unique = $unique | append (dict
        "Domain"  .Params.feed.domain
        "Favicon" .Params.feed.favicon
        "Home"    .Params.feed.home
        "Name"    .Params.feed.name
      )
    -}}
  {{- end -}}
{{- end -}}

<following-list>
  <h1>Following</h1>
  <aside>
    {{ range $author := first 3 (shuffle (uniq $following)) }}

    {{- $name := .Name -}}
    {{- $favicon := .Domain -}}
    {{- $href := print "http://" $author.Domain -}}

    {{- range $unique := uniq $unique -}}
      {{- if and (eq $unique.Name $name) (eq $unique.Domain $favicon) -}}
        {{- $favicon = $unique.Favicon -}}
        {{- $href = or $unique.Home $href -}}
      {{- end -}}
    {{- end -}}

      <micro-author>
        <micro-card>
          <micro-summary>
            <micro-thumbnail>
              <figure>
                <a title="{{ $author.Name }}" href="{{ $href }}">
                  <picture>
                    <img
                      width="64"
                      height="64"
                      alt="{{ $author.Name }}"
                      src="{{ $favicon }}"
                    />
                  </picture>
                </a>
              </figure>
            </micro-thumbnail>
            <micro-header>
              <h2><b>{{ $author.Name }}</b></h2>
              <h3><a title="{{ $author.Name }}" href="{{ $href }}">@{{ $author.Domain }}</a></h3>
            </micro-header>
            <a title="Follow {{ $author.Name }}" href="{{ $href }}">
              {{ safeHTML (readFile (print (partial "function-paths.html" "static") "/icons/feather/rss.svg")) }}
              <span>Follow</span>
            </a>
          </micro-summary>
        </micro-card>
      </micro-author>
    {{- end -}}
  </aside>
  {{- if not $following -}}
    <footer>
      <code>No feeds found!</code>
    </footer>
  {{- end -}}
</following-list>