blob: 4ec526af6b19c1b8167d98fab14a233bc4f72c81 (
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
|
{{ if .Site.Params.Social }}
<!-- Get SVG bundle -->
{{ $svgBundleLink := (partialCached "svg-bundle" .) }}
<!-- Reduce repetition... -->
{{ $centralized := $.Site.Params.Social.Centralized }}
{{ $decentralized := $.Site.Params.Social.Decentralized }}
<div class="social">
{{ range .Site.Data.social }}
{{ $currentEntry := .entry }}
{{ $currentLabel := .label }}
{{ $currentBase := .base }}
{{ $currentIcon := .icon.id }}
{{ if not .decentralized }}
{{ with (index $centralized $currentEntry) }}
{{ $url := $currentBase | replaceRE "<username>" (index . 0) }}
{{ $label := $currentLabel }}
{{ with (index . 1) }}
{{ $label = . }}
{{ end }}
<a class="btn" href="{{ $url }}" rel="me nofollow" title="{{ $label }}">
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<use xlink:href="{{ $svgBundleLink }}#{{ $currentIcon }}"/>
</svg>
<p>{{ $label }}</p>
</a>
{{ end }}
{{ else }}
{{ if (index $decentralized $currentEntry) }}
{{ range (index $decentralized $currentEntry) }}
<a class="btn" href="{{ index . 0 }}" rel="me nofollow" title="{{ printf "%s (%s)" (index . 1) $currentLabel }}">
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<use xlink:href="{{ $svgBundleLink }}#{{ $currentIcon }}"/>
</svg>
<p>{{ index . 1 | truncate 15 }}</p>
</a>
{{ end }}
{{ end }}
{{ end }}
{{ end }}
</div>
{{ end }}
|