Welcome to mirror list, hosted at ThFree Co, Russian Federation.

social.html « shortcodes « layouts - gitlab.com/rmaguiar/hugo-theme-color-your-world.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6add0025d57fb53dcef021ed7616eea6fc9f5224 (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
<!-- Reduce repetition... -->
{{ $centralizedOnPage   := $.Page.Params.Social.Centralized }}
{{ $centralizedOnSite   := $.Site.Params.Social.Centralized }}
{{ $decentralizedOnPage := $.Page.Params.Social.Decentralized }}
{{ $decentralizedOnSite := $.Site.Params.Social.Decentralized }}

<section class="social">

  {{ range .Site.Data.social }}

    {{ $currentEntry  := .entry }}
    {{ $currentLabel  := .label }}
    {{ $currentBase   := .base }}
    {{ $currentIcon   := .icon.id }}

    {{ if not .decentralized }}

      {{ with (index (or $centralizedOnPage $centralizedOnSite) $currentEntry) }}

        {{ $url   := printf "%s%s" $currentBase (index . 0) }}
        {{ $label := $currentLabel }}
      
        {{ with (index . 1) }}
          {{ $label = . }}
        {{ end }}
        
        <a rel="me nofollow" href="{{ $url }}" title="{{ $label }}">
          <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
            <use xlink:href="#{{ $currentIcon }}"/>
          </svg>

          <p>{{ $label }}</p>
        </a>

      {{ end }}

    {{ else }}

      {{ if (index (or $decentralizedOnPage $decentralizedOnSite) $currentEntry) }}

        {{ range (index (or $decentralizedOnPage $decentralizedOnSite) $currentEntry) }}
          <a rel="me nofollow" href="{{ index . 0 }}" title="{{ printf "%s (%s)" (index . 1) $currentLabel }}">
            <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
              <use xlink:href="#{{ $currentIcon }}"/>
            </svg>

            <p>{{ index . 1 | truncate 15 }}</p>
          </a>
        {{ end }}
        
      {{ end }}
      
    {{ end }}

  {{ end }}

</section>