Add HTML attributes to social links (fixes #121) (#125)

* Insert arbitrary HTML attributes to social links via config.toml

(fixes #121)
This commit is contained in:
Hanzei 2019-01-14 13:35:37 +01:00 committed by GitHub
commit 5bba25cd16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -53,6 +53,11 @@ DefaultContentLanguage = "en" # Default language fo
url = "mailto:youremail@email.com" # For a direct email link, use "mailto:test@example.org". url = "mailto:youremail@email.com" # For a direct email link, use "mailto:test@example.org".
icon = "paper-plane" # icon name without the 'fa-' icon = "paper-plane" # icon name without the 'fa-'
icon_pack = "fas" icon_pack = "fas"
[[params.social]]
url = "https://mastodon.social/"
icon = "mastodon" # icon name without the 'fa-'
icon_pack = "fab"
html_attributes = "rel=\"me\"" # Add rel attribute for Mastodon profile link verification
# If you don't want to use the default menu, you can define one by yourself # If you don't want to use the default menu, you can define one by yourself

View file

@ -1,6 +1,6 @@
<div class="social-icons"> <div class="social-icons">
{{ range .Site.Params.social }} {{ range .Site.Params.social }}
<a href="{{ .url }}"> <a href="{{ .url }}" {{ .html_attributes | safeHTMLAttr }}>
<i class="{{ .icon_pack}} fa-{{ .icon}}"></i> <i class="{{ .icon_pack}} fa-{{ .icon}}"></i>
</a> </a>
{{ end }} {{ end }}