2024-10-20 07:47:25 +02:00
|
|
|
{{- $context := . -}}
|
|
|
|
|
|
|
|
{{- $config := site.Params.ananke.social -}}
|
|
|
|
{{- $networks := $config.follow.networks -}}
|
|
|
|
{{- $setups := (collections.Where $config.networks "slug" "in" $networks) -}}
|
|
|
|
{{/* This here is an ugly workaround for GoHugo's missing sortByArray feature.
|
|
|
|
Let's cache it so it does not take away too much time.
|
|
|
|
PS: It's also a couple of years old, so maybe there is a better solution by now. */}}
|
2024-10-24 11:56:53 +02:00
|
|
|
{{- $setups = partials.IncludeCached "func/social/sortNetworks.html" (dict "networks" $networks "setups" $setups) "social-follow" -}}
|
2024-10-20 07:47:25 +02:00
|
|
|
|
|
|
|
<div class="ananke-socials">
|
|
|
|
{{- range $setups -}}
|
|
|
|
{{- $setup := . -}}
|
|
|
|
{{- $network := $setup.slug -}}
|
|
|
|
{{- $profile := index $config $network -}}
|
2024-10-27 14:24:03 +01:00
|
|
|
{{- $rel := $profile.rel | default "" -}}
|
2024-10-20 10:58:53 +02:00
|
|
|
{{- $label := $profile.label | default $setup.label -}}
|
2024-10-20 10:27:19 +02:00
|
|
|
|
2024-10-20 07:47:25 +02:00
|
|
|
{{- $link := (printf $setup.profile $profile.username) -}}
|
2024-10-20 10:27:19 +02:00
|
|
|
{{- with $profile.profilelink -}}
|
|
|
|
{{- $link = $profile.profilelink -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
2024-10-20 07:47:25 +02:00
|
|
|
{{- $languageDirection := cond (eq $.Site.Language.LanguageDirection "rtl") "ml1" "mr1" -}}
|
2024-10-20 12:23:51 +02:00
|
|
|
<a href="{{ $link }}" target="_blank" rel="noopener{{- with $rel }} {{ . -}}{{- end -}}"
|
2024-10-21 00:59:52 +02:00
|
|
|
class="ananke-social-link link-transition {{ $network }} link dib z-999 pt3 pt0-l {{ $languageDirection }}"
|
2024-10-20 10:58:53 +02:00
|
|
|
title="follow on {{ $label }} - Opens in a new window"
|
|
|
|
aria-label="follow on {{ $label }} - Opens in a new window">
|
2024-10-21 00:46:32 +02:00
|
|
|
{{/* @todo add the following lines to a partial, reused in social/share.html */}}
|
2024-10-20 07:47:25 +02:00
|
|
|
{{- with .icon -}}
|
|
|
|
{{- $icon := resources.Get (printf "ananke/socials/%s.svg" .) -}}
|
|
|
|
{{- with $icon -}}
|
|
|
|
<span class="icon">
|
|
|
|
{{ .Content | safeHTML }}
|
|
|
|
{{/* @todo indicator for missing or misconfigured icon */}}
|
|
|
|
</span>
|
|
|
|
{{- end -}}
|
|
|
|
{{- else -}}
|
2024-10-20 10:58:53 +02:00
|
|
|
{{- $label -}}
|
2024-10-20 07:47:25 +02:00
|
|
|
{{- end -}}
|
|
|
|
{{- with $config.follow.new_window_icon -}}
|
|
|
|
{{- partial "new-window-icon.html" . -}}
|
|
|
|
{{- end -}}
|
|
|
|
</a>
|
|
|
|
{{- end -}}
|
|
|
|
</div>
|