From 661e59b85d6761905da906018a26120a0b45ef5e Mon Sep 17 00:00:00 2001 From: Jimmy Cai Date: Sat, 23 Oct 2021 11:58:55 +0200 Subject: [PATCH] feat: social menu (#401) --- assets/icons/brand-github.svg | 6 ++++++ assets/icons/brand-twitter.svg | 6 ++++++ assets/scss/partials/menu.scss | 15 +++++++++++++++ exampleSite/config.yaml | 13 +++++++++++++ layouts/partials/sidebar/left.html | 20 ++++++++++++++++++++ 5 files changed, 60 insertions(+) create mode 100644 assets/icons/brand-github.svg create mode 100644 assets/icons/brand-twitter.svg diff --git a/assets/icons/brand-github.svg b/assets/icons/brand-github.svg new file mode 100644 index 0000000..1fe7e0b --- /dev/null +++ b/assets/icons/brand-github.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/icons/brand-twitter.svg b/assets/icons/brand-twitter.svg new file mode 100644 index 0000000..17ab1b1 --- /dev/null +++ b/assets/icons/brand-twitter.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/scss/partials/menu.scss b/assets/scss/partials/menu.scss index 2c7ad74..1d612d1 100644 --- a/assets/scss/partials/menu.scss +++ b/assets/scss/partials/menu.scss @@ -201,3 +201,18 @@ } } } + +.social-menu { + list-style: none; + padding: 0%; + display: flex; + flex-direction: row; + gap: 10px; + + svg { + width: 24px; + height: 24px; + stroke: var(--body-text-color); + stroke-width: 1.33; + } +} diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index d5cf58d..db3a8a9 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -178,6 +178,19 @@ menu: ### For demonstration purpose, the home link will be open in a new tab newTab: true icon: home + + social: + - identifier: github + name: GitHub + url: https://github.com/CaiJimmy/hugo-theme-stack + params: + icon: brand-github + + - identifier: twitter + name: Twitter + url: https://twitter.com + params: + icon: brand-twitter related: includeNewer: true diff --git a/layouts/partials/sidebar/left.html b/layouts/partials/sidebar/left.html index 9d4dd3e..108c029 100644 --- a/layouts/partials/sidebar/left.html +++ b/layouts/partials/sidebar/left.html @@ -29,8 +29,28 @@ {{ end }} {{ end }} +

{{ .Site.Title }}

{{ .Site.Params.sidebar.subtitle }}

+ + {{- with .Site.Menus.social -}} +
    + {{ range . }} +
  1. + + {{ $icon := default "link" .Params.Icon }} + {{ with $icon }} + {{ partial "helper/icon" . }} + {{ end }} + +
  2. + {{ end }} +
+ {{- end -}}