aboutsummaryrefslogtreecommitdiffstats
path: root/layouts/partials/social_links.html
blob: ea6ee851025097a5c09aa1ea0576b310144f7948 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{{ range .social }}
  {{ $pack := or .icon_pack "fas" }}
  {{ $pack_prefix := $pack }}
  {{ if in (slice "fab" "fas" "far" "fal") $pack }}
    {{ $pack_prefix = "fa" }}
  {{ end }}
  {{ $link := .link }}
  {{ $scheme := (urls.Parse $link).Scheme }}
  {{ $target := "" }}
  {{ if not $scheme }}
    {{ $link = .link | relLangURL }}
  {{ else if in (slice "http" "https") $scheme }}
    {{ $target = "target=\"_blank\" rel=\"noopener\"" }}
  {{ end }}
  <a
    href="{{ $link | safeURL }}"
    {{ $target | safeHTMLAttr }}
    class="link color-inherit"
  >
    <i class="{{ $pack }} {{ $pack_prefix }}-{{ .icon }} h2"></i>
  </a>
{{ end }}