Ver Fonte

Add option to disable email/phone linking in Contact section

George Cushen há 9 anos atrás
pai
commit
be17a08fda
2 ficheiros alterados com 13 adições e 1 exclusões
  1. 5 1
      exampleSite/config.toml
  2. 8 0
      layouts/partials/home_contact.html

+ 5 - 1
exampleSite/config.toml

@@ -20,7 +20,7 @@ googleAnalytics = ""
     address = "Stanford AI Lab, Stanford University, California, 90210, USA."
     phone = "888 888 88 88"
 
-    # Date format (refer to Go's formatting options)
+    # Date format (refer to Go's date format: http://flippinggodateformat.com )
     #   Examples: "Mon, Jan 2, 2006" or "2006-01-02"
     date_format = "Mon, Jan 2, 2006"
 
@@ -46,6 +46,10 @@ googleAnalytics = ""
         institution = "Massachusetts Institute of Technology"
         year = 2008
 
+    [params.contact]
+        # Automatically link email and phone?
+        autolink = true
+
     # Social/Academic Networking
     #
     # Icon pack "fa" includes the following social network icons:

+ 8 - 0
layouts/partials/home_contact.html

@@ -3,14 +3,22 @@
     {{ with .Site.Params.phone }}
     <li>
         <i class="fa fa-phone fa-fw" aria-hidden="true"></i>
+        {{ if and (isset $.Site.Params.contact "autolink") (eq $.Site.Params.contact.autolink false) }}
+        <span>{{ . }}</span>
+        {{ else }}
         <span><a href="tel:{{ . }}">{{ . }}</a></span>
+        {{ end }}
     </li>
     {{ end }}
 
     {{ with .Site.Params.email }}
     <li>
         <i class="fa fa-envelope fa-fw" aria-hidden="true"></i>
+        {{ if and (isset $.Site.Params.contact "autolink") (eq $.Site.Params.contact.autolink false) }}
+        <span>{{ . }}</span>
+        {{ else }}
         <span><a href="mailto:{{ . }}">{{ . }}</a></span>
+        {{ end }}
     </li>
     {{ end }}