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
This commit is contained in:
George Cushen 2017-10-29 21:23:47 +00:00
commit ec4fe2eb29
2 changed files with 15 additions and 2 deletions

View file

@ -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 = ""

View file

@ -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 }}