diff --git a/assets/ananke/css/_social-icons.css b/assets/ananke/css/_social-icons.css index 148d99f..ce96e9c 100644 --- a/assets/ananke/css/_social-icons.css +++ b/assets/ananke/css/_social-icons.css @@ -1,7 +1,16 @@ -.facebook, .twitter, .instagram, .youtube, .github, .gitlab, .keybase, .linkedin, .medium, .mastodon, .slack, .stackoverflow, .rss { - fill: #BABABA; +.ananke-socials a{ + display: inline-block; + vertical-align: middle; + color: #BABABA; + fill: currentColor; +} +.ananke-socials a .icon svg{ + width: 32px; + height: 32px; +} +.ananke-socials a:hover { + color: rgb(107, 114, 128); } - .new-window { opacity: 0; display: inline-block; @@ -10,55 +19,3 @@ .link-transition:hover .new-window{ opacity: 1; } - -.facebook:hover { - fill: #3b5998; -} - -.twitter:hover { - fill: #1da1f2; -} - -.instagram:hover { - fill: #e1306c; -} - -.youtube:hover { - fill: #cd201f; -} - -.github:hover { - fill: #6cc644; -} - -.gitlab:hover { - fill: #FC6D26; -} - -.keybase:hover { - fill: #3d76ff; -} - -.linkedin:hover { - fill: #0077b5 -} - -.medium:hover { - fill: #0077b5 -} - -.mastodon:hover { - fill: #3088d4; -} - -.slack:hover { - fill: #E01E5A; -} - -.stackoverflow:hover { - fill: #f48024; -} - -.rss:hover{ - fill: #ff6f1a; -} diff --git a/assets/ananke/socials/facebook.svg b/assets/ananke/socials/facebook.svg new file mode 100644 index 0000000..28c5889 --- /dev/null +++ b/assets/ananke/socials/facebook.svg @@ -0,0 +1 @@ + diff --git a/layouts/partials/svg/github.svg b/assets/ananke/socials/github.svg similarity index 87% rename from layouts/partials/svg/github.svg rename to assets/ananke/socials/github.svg index a362a60..11dc889 100644 --- a/layouts/partials/svg/github.svg +++ b/assets/ananke/socials/github.svg @@ -1,3 +1,3 @@ - + diff --git a/assets/ananke/socials/gitlab.svg b/assets/ananke/socials/gitlab.svg new file mode 100644 index 0000000..42b67bc --- /dev/null +++ b/assets/ananke/socials/gitlab.svg @@ -0,0 +1 @@ + diff --git a/assets/ananke/socials/instagram.svg b/assets/ananke/socials/instagram.svg new file mode 100644 index 0000000..8e7af59 --- /dev/null +++ b/assets/ananke/socials/instagram.svg @@ -0,0 +1 @@ + diff --git a/layouts/partials/svg/keybase.svg b/assets/ananke/socials/keybase.svg similarity index 96% rename from layouts/partials/svg/keybase.svg rename to assets/ananke/socials/keybase.svg index 9fdb8b3..73b0bc7 100644 --- a/layouts/partials/svg/keybase.svg +++ b/assets/ananke/socials/keybase.svg @@ -1,3 +1,3 @@ - + diff --git a/layouts/partials/svg/linkedin.svg b/assets/ananke/socials/linkedin.svg similarity index 79% rename from layouts/partials/svg/linkedin.svg rename to assets/ananke/socials/linkedin.svg index 3381996..3c310ed 100644 --- a/layouts/partials/svg/linkedin.svg +++ b/assets/ananke/socials/linkedin.svg @@ -1,3 +1,3 @@ - + diff --git a/layouts/partials/svg/mastodon.svg b/assets/ananke/socials/mastodon.svg similarity index 84% rename from layouts/partials/svg/mastodon.svg rename to assets/ananke/socials/mastodon.svg index 205345b..4600e65 100644 --- a/layouts/partials/svg/mastodon.svg +++ b/assets/ananke/socials/mastodon.svg @@ -1,4 +1,4 @@ - + diff --git a/layouts/partials/svg/medium.svg b/assets/ananke/socials/medium.svg similarity index 90% rename from layouts/partials/svg/medium.svg rename to assets/ananke/socials/medium.svg index cc5dc23..db48a5a 100644 --- a/layouts/partials/svg/medium.svg +++ b/assets/ananke/socials/medium.svg @@ -1,3 +1,3 @@ - + diff --git a/layouts/partials/svg/rss.svg b/assets/ananke/socials/rss.svg similarity index 100% rename from layouts/partials/svg/rss.svg rename to assets/ananke/socials/rss.svg diff --git a/layouts/partials/svg/slack.svg b/assets/ananke/socials/slack.svg similarity index 94% rename from layouts/partials/svg/slack.svg rename to assets/ananke/socials/slack.svg index 57974d4..3aef675 100644 --- a/layouts/partials/svg/slack.svg +++ b/assets/ananke/socials/slack.svg @@ -1,4 +1,4 @@ - + diff --git a/layouts/partials/svg/stackoverflow.svg b/assets/ananke/socials/stackoverflow.svg similarity index 96% rename from layouts/partials/svg/stackoverflow.svg rename to assets/ananke/socials/stackoverflow.svg index ece303f..7994742 100644 --- a/layouts/partials/svg/stackoverflow.svg +++ b/assets/ananke/socials/stackoverflow.svg @@ -2,7 +2,7 @@ style="enable-background:new 0 0 67 67;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" - width="{{ .size }}" + > diff --git a/assets/ananke/socials/twitter.svg b/assets/ananke/socials/twitter.svg new file mode 100644 index 0000000..3fdf872 --- /dev/null +++ b/assets/ananke/socials/twitter.svg @@ -0,0 +1 @@ + diff --git a/assets/ananke/socials/youtube.svg b/assets/ananke/socials/youtube.svg new file mode 100644 index 0000000..df0c89c --- /dev/null +++ b/assets/ananke/socials/youtube.svg @@ -0,0 +1 @@ + diff --git a/layouts/partials/func/socials/GetProjectServices.html b/layouts/partials/func/socials/GetProjectServices.html new file mode 100644 index 0000000..824daba --- /dev/null +++ b/layouts/partials/func/socials/GetProjectServices.html @@ -0,0 +1,21 @@ +{{ $services := slice }} + + +{{ $legacy_api_services := slice "facebook" "twitter" "instagram" "youtube" "github" "gitlab" "keybase" "linkedin" "medium" "mastodon" "slack" "stackoverflow" "rss" }} +{{ $user_using_legacy := false }} +{{ range $service := $legacy_api_services }} + {{ with index site.Params . }} + {{ $user_using_legacy = true }} + {{ $services = $services | append (dict "name" $service "url" .) }} + {{ end }} +{{ end }} + +{{ with site.Params.ananke_socials }} + {{ range $service := . }} + {{ with .name }} + {{ $services = $services | append $service }} + {{ end }} + {{ end }} +{{ end }} + +{{ return $services }} \ No newline at end of file diff --git a/layouts/partials/func/socials/GetServiceData.html b/layouts/partials/func/socials/GetServiceData.html new file mode 100644 index 0000000..bf87199 --- /dev/null +++ b/layouts/partials/func/socials/GetServiceData.html @@ -0,0 +1,8 @@ +{{ $service_data := dict }} +{{ $services_data := partialCached "func/socials/GetServicesData" "socials/GetServicesData" }} + +{{ with index $services_data $ }} + {{ $service_data = . }} +{{ end }} + +{{ return $service_data }} \ No newline at end of file diff --git a/layouts/partials/func/socials/GetServiceIcon.html b/layouts/partials/func/socials/GetServiceIcon.html new file mode 100644 index 0000000..3f67e8b --- /dev/null +++ b/layouts/partials/func/socials/GetServiceIcon.html @@ -0,0 +1,21 @@ +{{/* + GetServiceIcon + + User can overwrite/complement in assets/ananke/socials + + @author @regisphilibert + + @context String (.) + + @access private + + @return String of safe HTML + + @example - Go Template + {{ $icon := partialCached "tnd-socials/private/GetIcon" $icon $icon }} +*/}} +{{ $icon := "" }} +{{ with resources.Get (printf "ananke/socials/%s.svg" $) }} + {{ $icon = .Content | safeHTML }} +{{ end }} +{{ return $icon }} \ No newline at end of file diff --git a/layouts/partials/func/socials/GetServicesData.html b/layouts/partials/func/socials/GetServicesData.html new file mode 100644 index 0000000..750c96e --- /dev/null +++ b/layouts/partials/func/socials/GetServicesData.html @@ -0,0 +1,44 @@ +{{ return (` + facebook: + share: true + label: Facebook + color: '#3b5998' + twitter: + share: true + label: Twitter + color: '#1da1f2' + instagram: + label: Instagram + color: '#e1306c' + youtube: + label: YouTube + color: '#cd201f' + github: + label: GitHub + color: '#6cc644' + gitlab: + label: GitLab + color: '#FC6D26' + keybase: + label: Keybase + color: '#3d76ff' + linkedin: + share: true + label: LinkedIn + color: '#0077b5' + medium: + label: Medium + color: '#0077b5' + mastodon: + label: Mastodon + color: '#3088d4' + slack: + label: Slack + color: '#E01E5A' + stackoverflow: + label: Stack Overflow + color: '#f48024' + rss: + label: RSS + color: '#ff6f1a' + ` | transform.Unmarshal) }} \ No newline at end of file diff --git a/layouts/partials/func/socials/GetSocials.html b/layouts/partials/func/socials/GetSocials.html new file mode 100644 index 0000000..6d7bb16 --- /dev/null +++ b/layouts/partials/func/socials/GetSocials.html @@ -0,0 +1,18 @@ +{{/* + +*/}} +{{ $socials := slice }} +{{ with partial "func/socials/GetProjectServices" "GetProjectServices" }} + {{ range . }} + {{ $service := . }} + {{ with partialCached "func/socials/GetServiceData" .name .name }} + {{ $service = merge . $service }} + {{ end }} + {{ with partialCached "func/socials/GetServiceIcon" .name .name }} + {{ $service = $service | merge (dict "icon" . ) }} + {{ end }} + {{ $socials = $socials | append $service }} + {{ end }} +{{ end }} + +{{ return $socials }} \ No newline at end of file diff --git a/layouts/partials/site-style.html b/layouts/partials/site-style.html index d2c25e4..fb23397 100644 --- a/layouts/partials/site-style.html +++ b/layouts/partials/site-style.html @@ -6,7 +6,7 @@ `use` setting allow us to skip the postcss.config file. */}} {{ $options := (dict "targetPath" "/ananke/css/main.css" "enableSourceMap" true "precision" 6 "includePaths" (slice "node_modules")) }} - {{ $style := . | resources.ToCSS $options | resources.PostCSS (dict "use" "postcss-cssnext") | minify }} + {{ $style := . | resources.ToCSS $options | resources.PostCSS | minify }} {{/* We fingerprint in production to ensure cache busting */}} {{ if eq (getenv "HUGO_ENV") "production" }} {{ $style = . | fingerprint }} diff --git a/layouts/partials/social-follow.html b/layouts/partials/social-follow.html index 0755ce2..ba0b6e8 100644 --- a/layouts/partials/social-follow.html +++ b/layouts/partials/social-follow.html @@ -1,80 +1,13 @@ - -{{ $icon_size := "32px" }} -{{ with .Param "stackoverflow" }} - - {{ partial "svg/stackoverflow.svg" (dict "size" $icon_size) }} - {{- partial "new-window-icon.html" . -}} - -{{ end }} -{{ with .Param "facebook" }} - -{{ end }} -{{ with .Param "twitter" }} - -{{ end }} -{{ with .Param "instagram" }} - - {{ partial "svg/instagram.svg" (dict "size" $icon_size) }} - {{- partial "new-window-icon.html" . -}} - -{{ end }} -{{ with .Param "youtube" }} - - {{ partial "svg/youtube.svg" (dict "size" $icon_size) }} - {{- partial "new-window-icon.html" . -}} - -{{ end }} -{{ with .Param "linkedin" }} - - {{ partial "svg/linkedin.svg" (dict "size" $icon_size) }} - {{- partial "new-window-icon.html" . -}} - -{{ end }} -{{ with .Param "github" }} - - {{ partial "svg/github.svg" (dict "size" $icon_size) }} - {{- partial "new-window-icon.html" . -}} - -{{ end }} -{{ with .Param "gitlab" }} - - {{ partial "svg/gitlab.svg" (dict "size" $icon_size) }} - {{- partial "new-window-icon.html" . -}} - -{{ end }} -{{ with .Param "keybase" }} - - {{ partial "svg/keybase.svg" (dict "size" $icon_size) }} - {{- partial "new-window-icon.html" . -}} - -{{ end }} -{{ with .Param "medium" }} - - {{ partial "svg/medium.svg" (dict "size" $icon_size) }} - {{- partial "new-window-icon.html" . -}} - -{{ end }} -{{ with .Param "mastodon" }} - - {{ partial "svg/mastodon.svg" (dict "size" $icon_size) }} - {{- partial "new-window-icon.html" . -}} - -{{ end }} -{{ with .Param "slack" }} - - {{ partial "svg/slack.svg" (dict "size" $icon_size) }} - {{- partial "new-window-icon.html" . -}} - -{{ end }} -{{ with .Param "rss" }} - - {{ partial "svg/rss.svg" (dict "size" $icon_size) }} - {{- partial "new-window-icon.html" . -}} - -{{ end }} +{{ $socials := partialCached "func/socials/GetSocials" "socials/GetSocials" }} +
+ {{ range $socials }} + + {{ with .icon }} + {{ . }} + {{ else }} + {{ .label }} + {{ end }} + {{- partial "new-window-icon.html" . -}} + + {{ end }} +
diff --git a/layouts/partials/social-share.html b/layouts/partials/social-share.html index eb313c0..f5a56b7 100644 --- a/layouts/partials/social-share.html +++ b/layouts/partials/social-share.html @@ -1,26 +1,24 @@ {{ $title := .Title }} {{ $url := printf "%s" .Permalink | absLangURL }} -{{ $icon_size := "32px" }} +{{ $facebook_href := printf "https://www.facebook.com/sharer.php?u=%s" $url }} +{{ $twitter_href := printf "https://twitter.com/share?url=%s&text=%s" $url $title }} +{{ with .Site.Social.twitter }} + {{ $twitter_href = printf "%s&via=%s" $twitter_href . }} +{{ end }} +{{ $linkedin_href := printf "https://www.linkedin.com/shareArticle?mini=true&url=%s&title=%s" $url $title }} +{{ $hrefs := dict "facebook" $facebook_href "twitter" $twitter_href "linkedin" $linkedin_href }} + +{{ $services := where (partialCached "func/socials/GetSocials" "socials/GetSocials") "share" true }} {{ if not .Params.disable_share }} -
- - {{ $facebook_href := printf "https://www.facebook.com/sharer.php?u=%s" $url }} - - {{ partialCached "svg/facebook.svg" (dict "size" $icon_size) $icon_size }} - - - {{ $twitter_href := printf "https://twitter.com/share?url=%s&text=%s" $url $title }} - {{ with .Site.Social.twitter }} - {{ $twitter_href = printf "%s&via=%s" $twitter_href . }} +
+ {{ range $service := $services }} + {{ $href := index $hrefs .name }} + + {{ with .icon }} + {{ . }} + {{ end }} + {{ end }} - - - {{ $linkedin_href := printf "https://www.linkedin.com/shareArticle?mini=true&url=%s&title=%s" $url $title }} - - {{ partialCached "svg/linkedin.svg" (dict "size" $icon_size) $icon_size }} -
{{ end }} diff --git a/layouts/partials/svg/facebook.svg b/layouts/partials/svg/facebook.svg deleted file mode 100644 index 0afb80f..0000000 --- a/layouts/partials/svg/facebook.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/layouts/partials/svg/gitlab.svg b/layouts/partials/svg/gitlab.svg deleted file mode 100644 index 36a3bed..0000000 --- a/layouts/partials/svg/gitlab.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/layouts/partials/svg/instagram.svg b/layouts/partials/svg/instagram.svg deleted file mode 100644 index 2fa7d47..0000000 --- a/layouts/partials/svg/instagram.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/layouts/partials/svg/new-window.svg b/layouts/partials/svg/new-window.svg index ba148ad..ebb37b8 100644 --- a/layouts/partials/svg/new-window.svg +++ b/layouts/partials/svg/new-window.svg @@ -1,3 +1,3 @@ - + diff --git a/layouts/partials/svg/twitter.svg b/layouts/partials/svg/twitter.svg deleted file mode 100644 index 6803558..0000000 --- a/layouts/partials/svg/twitter.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/layouts/partials/svg/youtube.svg b/layouts/partials/svg/youtube.svg deleted file mode 100644 index 9a55379..0000000 --- a/layouts/partials/svg/youtube.svg +++ /dev/null @@ -1 +0,0 @@ -