Sfoglia il codice sorgente

about widget: Add support for linking to forum/chat/mailing-list

* Example: `discussion = { name = "Discuss", url = "https://discourse.gohugo.io" }`
  can be added to `[params]` section of `config.toml`
* Add noopener to links that open in new tab

See #351
George Cushen 7 anni fa
parent
commit
ec4fe2eb29
2 ha cambiato i file con 15 aggiunte e 2 eliminazioni
  1. 4 0
      exampleSite/config.toml
  2. 11 2
      layouts/partials/widgets/contact.html

+ 4 - 0
exampleSite/config.toml

@@ -58,6 +58,10 @@ defaultContentLanguageInSubdir = false
   # Enable Keybase in Contact section by entering your keybase.io username.
   keybase = ""
 
+  # Discussion link (e.g. link to a forum, mailing list, or chat).
+  #   Uncomment line below to use.
+  #   discussion = { name = "Discuss", url = "https://discourse.gohugo.io" }
+
   # Diplay a logo in navigation bar rather than title (optional).
   #   To enable, place an image in `static/img/` and reference its filename below. To disable, set the value to "".
   logo = ""

+ 11 - 2
layouts/partials/widgets/contact.html

@@ -22,11 +22,20 @@
       </li>
       {{ end }}
 
+      {{ with $.Site.Params.discussion }}
+      <li>
+        <i class="fa-li fa fa-comments-o fa-2x" aria-hidden="true"></i>
+        <span>
+          <a href="{{ .url }}" target="_blank" rel="noopener">{{ .name }}</a>
+        </span>
+      </li>
+      {{ end }}
+
       {{ with $.Site.Params.keybase }}
       <li>
         <i class="fa-li fa fa-lock fa-2x" aria-hidden="true"></i>
         <span>
-          <a href="https://keybase.io/{{ . }}" target="_blank">@{{ . }}</a> on Keybase.
+          <a href="https://keybase.io/{{ . }}" target="_blank" rel="noopener">@{{ . }}</a> on Keybase.
         </span>
       </li>
       {{ end }}
@@ -53,7 +62,7 @@
       <li>
         <i class="fa-li fa fa-telegram fa-2x" aria-hidden="true"></i>
         <span>
-        {{- if $autolink }}<a href="https://telegram.me/{{ . }}" target="_blank">@{{ . }}</a>{{ else }}@{{ . }}{{ end -}}
+        {{- if $autolink }}<a href="https://telegram.me/{{ . }}" target="_blank" rel="noopener">@{{ . }}</a>{{ else }}@{{ . }}{{ end -}}
         </span>
       </li>
       {{ end }}