diff options
author | Fabien CASTERS <fabien@vaga.io> | 2021-03-05 14:11:46 +0300 |
---|---|---|
committer | Fabien <vaga@users.noreply.github.com> | 2021-03-05 14:29:43 +0300 |
commit | 6309c01d84115f4f4b721b8eec8416944f7ea986 (patch) | |
tree | 234940bd9585c27c50446619195086e986c40158 | |
parent | 0b0e233a3e7ad2140104cb584b6094f352e8aa21 (diff) |
add params.social.name to display the name on mouseover
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | exampleSite/config.toml | 2 | ||||
-rw-r--r-- | layouts/_default/baseof.html | 4 | ||||
-rw-r--r-- | layouts/partials/icon.html | 3 |
4 files changed, 7 insertions, 3 deletions
@@ -50,6 +50,7 @@ To add a social link, add the following lines in `params`: ``` [[params.social]] icon = "github" + name = "My Github" url = "https://github.com/vaga" ``` diff --git a/exampleSite/config.toml b/exampleSite/config.toml index b3c9036..8aaadf8 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -20,9 +20,11 @@ paginate = 5 menu_item_separator = " - " [[params.social]] icon = "github" + name = "Github" url = "https://github.com/gohugoio" [[params.social]] icon = "twitter" + name = "Twitter" url = "https://twitter.com/gohugoio" # Brown theme diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index d4fb410..01ef5c4 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -34,7 +34,9 @@ {{- with .Site.Params.social }} <div class="app-header-social"> {{ range . }} - <a href="{{ .url }}" target="_blank" rel="noreferrer noopener">{{ partial "icon.html" (dict "ctx" $ "name" .icon) }}</a> + <a href="{{ .url }}" target="_blank" rel="noreferrer noopener"> + {{ partial "icon.html" (dict "ctx" $ "name" .icon "title" .name) }} + </a> {{ end }} </div> {{- end }} diff --git a/layouts/partials/icon.html b/layouts/partials/icon.html index 123bd23..06f8a42 100644 --- a/layouts/partials/icon.html +++ b/layouts/partials/icon.html @@ -1,6 +1,6 @@ {{- if isset .ctx.Site.Data.m10c.icons .name -}} <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-{{ .name }}"> - <title>{{ .name }}</title> + <title>{{ .title | default .name }}</title> {{ safeHTML (index .ctx.Site.Data.m10c.icons .name) }} </svg> {{- else -}} @@ -9,4 +9,3 @@ <path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path> </svg> {{- end -}} - |