aboutsummaryrefslogtreecommitdiff
path: root/themes/default/layouts/partials/author-card.html
blob: 3e4bccacee21393f78671ce3078c839d344ae884 (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
{{- $path       := print "public/" .Data.user "/media/profile/picture.png" -}}
{{- $image      := resources.Get $path -}}
{{- $dimensions := "96x96" -}}
{{- $404image   := resources.Get "data/media/404.png" -}}

<micro-author>
  <micro-card>
    <micro-summary>
    <micro-thumbnail>
      <figure>
        <a title="{{ .Data.name }}" href="{{ "" | absURL }}/{{ .Data.user }}/#">
          <picture>
            {{- with $image }}
              {{- $image = .Content | resources.FromString (print (partial "function-paths-media.html") "/" $.Data.user "/" (path.Base .)) }}
              <source srcset="{{- ($image.Fit (print $dimensions " webp")).RelPermalink -}}" type="image/webp" />
            {{- end }}
            <img
              alt="{{ .Data.name }}"
              {{- if fileExists $path }}
              {{ with $image }}
              {{- $image = (.Content | resources.FromString (print (partial "function-paths-media.html") "/" $.Data.user "/" (path.Base .))).Fit $dimensions -}}
              width="{{ $image.Width }}"
              height="{{ $image.Height }}"
              src="{{ $image.RelPermalink }}"
              {{- end }}
              {{ else }}
              width="{{ $404image.Width }}"
              height="{{ $404image.Height }}"
              src="{{ $404image.RelPermalink }}"
              {{- end -}}
            />
          </picture>
        </a>
      </figure>
    </micro-thumbnail>
      <micro-header>
        <h2><b>{{ .Data.name }}</b></h2>
        <h3><a title="{{ .Data.name }}" href="{{ "" | absURL }}/{{ .Data.user }}/#">@{{ .Data.user }}</a></h3>
      </micro-header>
      <a title="Follow with RSS Reader" href="{{ "" | absURL }}/{{ .Data.user }}/rss.xml">
        {{ safeHTML (readFile (print (partial "function-paths-static.html") "/icons/feather/rss.svg")) }}
        <span>Follow</span>
      </a>
    </micro-summary>
  </micro-card>
</micro-author>