Browse Source

fix(profile): fix `social` link when mailto scheme is used

Fix #763
George Cushen 6 years ago
parent
commit
8a4a302d47
2 changed files with 12 additions and 6 deletions
  1. 5 2
      layouts/partials/page_author.html
  2. 7 4
      layouts/partials/widgets/about.html

+ 5 - 2
layouts/partials/page_author.html

@@ -25,11 +25,14 @@
         {{ $pack_prefix = "fa" }}
       {{ end }}
       {{ $target := "target=\"_blank\" rel=\"noopener\"" }}
-      {{ if not (urls.Parse .link).Scheme }}
+      {{ $link := .link }}
+      {{ $scheme := (urls.Parse $link).Scheme }}
+      {{ if not $scheme }}
         {{ $target = "" }}
+        {{ $link = .link | relLangURL }}
       {{ end }}
       <li>
-        <a itemprop="sameAs" href="{{ .link | relLangURL | safeURL }}" {{ $target | safeHTMLAttr }}>
+        <a itemprop="sameAs" href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }}>
           <i class="{{ $pack }} {{ $pack_prefix }}-{{ .icon }}"></i>
         </a>
       </li>

+ 7 - 4
layouts/partials/widgets/about.html

@@ -44,12 +44,15 @@
           {{ $pack_prefix = "fa" }}
         {{ end }}
         {{ $target := "target=\"_blank\" rel=\"noopener\"" }}
-          {{ if not (urls.Parse .link).Scheme }}
-        {{ $target = "" }}
+        {{ $link := .link }}
+        {{ $scheme := (urls.Parse $link).Scheme }}
+        {{ if not $scheme }}
+          {{ $target = "" }}
+          {{ $link = .link | relLangURL }}
         {{ end }}
         <li>
-          <a itemprop="sameAs" href="{{ .link | relLangURL | safeURL }}" {{ $target | safeHTMLAttr }}>
-            <i class="{{ $pack }} {{ $pack_prefix }}-{{ .icon }} big-icon"></i>
+          <a itemprop="sameAs" href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }}>
+            <i class="{{ $pack }} {{ $pack_prefix }}-{{ .icon }} big-icon"></i>{{ $scheme }}
           </a>
         </li>
         {{ end }}