mirror of https://github.com/theNewDynamic/gohugo-theme-ananke.git

Patrick Kollitsch
8 days ago 0cb0c552290ca8eb6236877d1f13a599e0a606a5
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
{{- $context := . -}}
{{- $disabled := $context.Params.disable_share | compare.Default "false" -}}
{{- $config := site.Params.ananke.social -}}
{{- with $config.share.disable_share -}}
  {{- $disabled := . -}}
{{- end -}}
 
{{- if compare.Eq "false" $disabled -}}
 
  {{- $title := $context.Title -}}
  {{- $url := fmt.Printf "%s" $context.Permalink | urls.AbsLangURL -}}
 
  {{- $networks := $config.share.networks -}}
  {{- $hasLabel := $config.share.sharetext | compare.Default "true" -}}
  {{- $hasIcon := $config.share.icons | compare.Default "true" -}}
 
  <div id="sharing" class="mt3 ananke-socials">
    {{- range $networks -}}
      {{- $network := . -}}
      {{- $setup := collections.Index $config.networks $network -}}
      {{/* @todo lang.Translate $sharetext := lang.Translate (fmt.Printf "share_on_%s" $setup.slug) */}}
      {{- $label := "" -}}
      {{ with $config.share.sharetext -}}
        {{- $label = fmt.Printf "Share on %s" $setup.label -}}
      {{- end -}}
      {{ if compare.Eq $setup.share "false" | compare.Default "true" -}}
        {{- continue -}}
        {{/* @todo notification into CLI that a network is configured but not supported */}}
      {{- end -}}
      {{- $options := (dict "context" page "setup" $setup) }}
      {{- $href := partials.Include "func/social/getShareLink.html" $options -}}
      <a href="{{ $href }}"
        class="ananke-social-link {{ $setup.slug }} no-underline"
        title="{{ $label }}" aria-label="{{ $label }}"
        target="_blank" rel="nofollow noopener noreferrer">
        {{ with $config.share.icons -}}
          {{/* @todo add the following lines to a partial, reused collections.In social/follow.html */}}
          {{- with $setup.icon -}}
            {{- $icon := resources.Get (fmt.Printf "ananke/socials/%s.svg" .) -}}
            {{- with $icon -}}
              <span class="icon">
                {{ .Content | safe.HTML }}
                {{/* @todo indicator for missing or misconfigured icon */}}
              </span>
            {{- end -}}
          {{- else -}}
            {{- $label -}}
          {{- end -}}
        {{- else -}}
          {{- $label -}}
        {{- end -}}
      </a>
    {{- end -}}
  </div>
 
{{- end -}} {{/* if compare.Eq "true" $disabled */}}