From 6309c01d84115f4f4b721b8eec8416944f7ea986 Mon Sep 17 00:00:00 2001 From: Fabien CASTERS Date: Fri, 5 Mar 2021 12:11:46 +0100 Subject: add params.social.name to display the name on mouseover --- README.md | 1 + exampleSite/config.toml | 2 ++ layouts/_default/baseof.html | 4 +++- layouts/partials/icon.html | 3 +-- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c506cd3..1f9453c 100644 --- a/README.md +++ b/README.md @@ -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 }}
{{ range . }} - {{ partial "icon.html" (dict "ctx" $ "name" .icon) }} + + {{ partial "icon.html" (dict "ctx" $ "name" .icon "title" .name) }} + {{ end }}
{{- 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 -}} - {{ .name }} + {{ .title | default .name }} {{ safeHTML (index .ctx.Site.Data.m10c.icons .name) }} {{- else -}} @@ -9,4 +9,3 @@ {{- end -}} - -- cgit v1.2.3