-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathsocial-icons.html
36 lines (34 loc) · 2.59 KB
/
social-icons.html
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
{{- $socialAccounts := (query "account-data.rq" . ) -}}
{{- $details := index (query "organization-optional.rq" .) 0 -}}
{{- $preview_count := 0 -}}
{{- if or (len $socialAccounts) $details.website -}}
<ul>
{{- if $details.website -}}
<li><a rel="nofollow" title="Website" href="{{ $details.website }}"><img loading="lazy" width="20" height="20" aria-hidden="true" src="/social-icons/website.svg" /></a></li>
{{- end -}}
{{- range $socialAccounts -}}
{{- if eq .property (uri "http://www.wikidata.org/entity/P2002") -}}{{/* X */}}
{{- $preview_count = add1 $preview_count -}}
<li><a rel="nofollow" title="X" href="{{ .url }}"><img loading="lazy" width="20" height="20" aria-hidden="true" src="/social-icons/X.svg" /></a></li>
{{- else if eq .property (uri "http://www.wikidata.org/entity/P2397") -}}{{/* YouTube */}}
{{- $preview_count = add1 $preview_count -}}
<li><a rel="nofollow" title="YouTube" href="{{ .url }}"><img loading="lazy" width="20" height="20" aria-hidden="true" src="/social-icons/youtube.svg" /></a></li>
{{- else if eq .property (uri "http://www.wikidata.org/entity/P4264") -}}{{/* LinkedIn */}}
{{- $preview_count = add1 $preview_count -}}
<li><a rel="nofollow" title="LinkedIn" href="{{ .url }}"><img loading="lazy" width="20" height="20" aria-hidden="true" src="/social-icons/linkedin.svg" /></a></li>
{{- else if eq .property (uri "http://www.wikidata.org/entity/P2013") -}}{{/* Facebook */}}
{{- $preview_count = add1 $preview_count -}}
<li><a rel="nofollow" title="Facebook" href="{{ .url }}"><img loading="lazy" width="20" height="20" aria-hidden="true" src="/social-icons/facebook.svg" /></a></li>
{{- else if eq .property (uri "http://www.wikidata.org/entity/P2003") -}}{{/* Instagram */}}
{{- $preview_count = add1 $preview_count -}}
<li><a rel="nofollow" title="Instagram" href="{{ .url }}"><img loading="lazy" width="20" height="20" aria-hidden="true" src="/social-icons/instagram.svg" /></a></li>
{{- else if eq .property (uri "http://www.wikidata.org/entity/P4033") -}}{{/* Mastodon */}}
{{- $preview_count = add1 $preview_count -}}
<li><a rel="nofollow" title="Mastodon" href="{{ .url }}"><img loading="lazy" width="20" height="20" aria-hidden="true" src="/social-icons/mastodon.svg" /></a></li>
{{- end -}}
{{- end -}}
{{- if ne (sub (len $socialAccounts) $preview_count) 0 -}}
<li>+{{ sub (len $socialAccounts) $preview_count }}</li>
{{- end -}}
</ul>
{{- end -}}