summaryrefslogtreecommitdiff
path: root/layouts/partials/sns-links.html
blob: 52b0950dc8f4fd941d738598a6d5a8a3cd948c76 (plain) (blame)
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
{{- $socialMap := resources.Get "data/social.toml" | transform.Unmarshal -}}
{{ $socialList := slice }}
{{- range $key, $value := .social -}}
  {{ if $value }}
  {{- $social := $key | lower | index $socialMap | default dict -}}
  {{- if reflect.IsMap $value -}}
    {{- $social = merge $social $value -}}

  {{- else if and $social (ne $value true)  -}}
    {{ $social = merge $social (dict "id" $value) }}
    
  {{- else if $value -}}
  {{- else -}}
  {{ $social = dict }}
  {{- end -}}
  {{- with $social -}}
  {{ $socialList = $socialList | append (dict "title" $key | merge $social) }}
  {{- end -}}

  {{ end }}
{{- end -}}

{{- if .center -}}
<ul class="list-inline text-center">
{{- else -}}
<ul class="list-inline">
{{- end -}}

{{- range sort $socialList "weight" -}}
{{ $destination := "" }}
{{ if .url }}
{{ $destination = .url | relURL }}
{{ else if .format }}
{{ $destination = printf (string .format) .id }}
{{- end -}}
<li>
  <a rel="me" href="{{ $destination | safeURL }}" {{- if (urls.Parse $destination).Host | or .newtab }} target="_blank" {{- end -}}>
    <span class="fa-stack fa-lg">
      <i class="fa fa-circle fa-stack-2x"></i>
      <i class="{{ .icon }} fa-stack-1x fa-inverse">{{- .text -}}</i>
    </span>
  </a>
</li>
{{- end -}}

</ul>