Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/rmaguiar/hugo-theme-color-your-world.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrmaguiar <rmaguiar@tuta.io>2020-07-08 01:53:06 +0300
committerrmaguiar <rmaguiar@tuta.io>2020-07-08 01:53:06 +0300
commitec1adfd5b89444445e74a394bc06b4c03a9c3f1a (patch)
tree80da3a727aeb62e5d354ea880a9eb7e04cd4b05e /layouts
parentc6b316091bd2cb3e6f5fd046999a54cd18f553d2 (diff)
Update social shortcode and minor changes
* Update social shortcode. It should be easier to add new platforms now * Add Flickr, PeerTube, Strava, Twitch, Vimeo, WhatsApp and YouTube * Other minor changes
Diffstat (limited to 'layouts')
-rw-r--r--layouts/shortcodes/social.html273
1 files changed, 38 insertions, 235 deletions
diff --git a/layouts/shortcodes/social.html b/layouts/shortcodes/social.html
index 7e94a9b..733c184 100644
--- a/layouts/shortcodes/social.html
+++ b/layouts/shortcodes/social.html
@@ -1,256 +1,59 @@
{{ $icons := (.Page.Scratch.Get "svgBundle").RelPermalink }}
<!-- Reduce repetition... -->
-{{ $centralizedOnPage := .Page.Params.Social.Centralized }}
-{{ $centralizedOnSite := .Site.Params.Social.Centralized }}
-{{ $decentralizedOnPage := .Page.Params.Social.Decentralized }}
-{{ $decentralizedOnSite := .Site.Params.Social.Decentralized }}
+{{ $centralizedOnPage := $.Page.Params.Social.Centralized }}
+{{ $centralizedOnSite := $.Site.Params.Social.Centralized }}
+{{ $decentralizedOnPage := $.Page.Params.Social.Decentralized }}
+{{ $decentralizedOnSite := $.Site.Params.Social.Decentralized }}
<section class="social">
- {{ with or $centralizedOnPage.facebook $centralizedOnSite.facebook }}
-
- {{ $url := (index . 0) }}
- {{ $label := "Facebook" }}
-
- {{ with (index . 1) }}
- {{ $label = . }}
- {{ end }}
-
- <a rel="me nofollow" href="{{ $url }}" title="{{ $label }}">
- <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
- <use xlink:href="{{ $icons }}#facebook"/>
- </svg>
-
- <p>{{ $label }}</p>
- </a>
-
- {{ end }}
-
- {{ with or $centralizedOnPage.github $centralizedOnSite.github }}
-
- {{ $url := (index . 0) }}
- {{ $label := "GitHub" }}
-
- {{ with (index . 1) }}
- {{ $label = . }}
- {{ end }}
-
- <a rel="me nofollow" href="{{ $url }}" title="{{ $label }}">
- <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
- <use xlink:href="{{ $icons }}#github"/>
- </svg>
-
- <p>{{ $label }}</p>
- </a>
-
- {{ end }}
-
- {{ with or $centralizedOnPage.gitlab $centralizedOnSite.gitlab }}
-
- {{ $url := (index . 0) }}
- {{ $label := "GitLab" }}
-
- {{ with (index . 1) }}
- {{ $label = . }}
- {{ end }}
-
- <a rel="me nofollow" href="{{ $url }}" title="{{ $label }}">
- <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
- <use xlink:href="{{ $icons }}#gitlab"/>
- </svg>
-
- <p>{{ $label }}</p>
- </a>
-
- {{ end }}
-
- {{ with or $centralizedOnPage.instagram $centralizedOnSite.instagram }}
-
- {{ $url := (index . 0) }}
- {{ $label := "Instagram" }}
-
- {{ with (index . 1) }}
- {{ $label = . }}
- {{ end }}
-
- <a rel="me nofollow" href="{{ $url }}" title="{{ $label }}">
- <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
- <use xlink:href="{{ $icons }}#instagram"/>
- </svg>
-
- <p>{{ $label }}</p>
- </a>
-
- {{ end }}
-
- {{ with or $centralizedOnPage.keybase $centralizedOnSite.keybase }}
-
- {{ $url := (index . 0) }}
- {{ $label := "Keybase" }}
-
- {{ with (index . 1) }}
- {{ $label = . }}
- {{ end }}
-
- <a rel="me nofollow" href="{{ $url }}" title="{{ $label }}">
- <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
- <use xlink:href="{{ $icons }}#keybase"/>
- </svg>
-
- <p>{{ $label }}</p>
- </a>
-
- {{ end }}
-
- {{ with or $centralizedOnPage.linkedin $centralizedOnSite.linkedin }}
-
- {{ $url := (index . 0) }}
- {{ $label := "LinkedIn" }}
-
- {{ with (index . 1) }}
- {{ $label = . }}
- {{ end }}
-
- <a rel="me nofollow" href="{{ $url }}" title="{{ $label }}">
- <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
- <use xlink:href="{{ $icons }}#linkedin"/>
- </svg>
-
- <p>{{ $label }}</p>
- </a>
-
- {{ end }}
-
+ {{ range .Site.Data.social }}
+ {{ $currentEntry := .entry }}
+ {{ $currentLabel := .label }}
+ {{ $currentBase := .base }}
+ {{ $currentIcon := .icon.id }}
- {{ if or $decentralizedOnPage.mastodon $decentralizedOnSite.mastodon }}
-
- {{ range or $decentralizedOnPage.mastodon $decentralizedOnSite.mastodon }}
+ {{ if not .decentralized }}
- <a rel="me nofollow" href="{{ index . 0 }}" title="{{ index . 1 }} (Mastodon)">
- <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
- <use xlink:href="{{ $icons }}#mastodon"/>
- </svg>
+ {{ with (index (or $centralizedOnPage $centralizedOnSite) $currentEntry) }}
- <p>{{ index . 1 | truncate 15 }}</p>
- </a>
-
- {{ end }}
-
- {{ end }}
-
- {{ if or $decentralizedOnPage.matrix $decentralizedOnSite.matrix }}
-
- {{ range or $decentralizedOnPage.matrix $decentralizedOnSite.matrix }}
- <a rel="me nofollow" href="{{ index . 0 }}" title="{{ index . 1 }} (Matrix)">
- <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
- <use xlink:href="{{ $icons }}#matrix"/>
- </svg>
+ {{ $url := printf "%s%s" $currentBase (index . 0) }}
+ {{ $label := $currentLabel }}
+
+ {{ with (index . 1) }}
+ {{ $label = . }}
+ {{ end }}
+
+ <a rel="me nofollow" href="{{ $url }}" title="{{ $label }}">
+ <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
+ <use xlink:href="{{ printf "%s#%s" $icons $currentIcon }}"/>
+ </svg>
- <p>{{ index . 1 | truncate 15 }}</p>
- </a>
- {{ end }}
-
- {{ end }}
-
-
- {{ with or $centralizedOnPage.medium $centralizedOnSite.medium }}
-
- {{ $url := (index . 0) }}
- {{ $label := "Medium" }}
-
- {{ with (index . 1) }}
- {{ $label = . }}
- {{ end }}
-
- <a rel="me nofollow" href="{{ $url }}" title="{{ $label }}">
- <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
- <use xlink:href="{{ $icons }}#medium"/>
- </svg>
+ <p>{{ $label }}</p>
+ </a>
- <p>{{ $label }}</p>
- </a>
-
- {{ end }}
-
-
- {{ with or $centralizedOnPage.reddit $centralizedOnSite.reddit }}
-
- {{ $url := (index . 0) }}
- {{ $label := "Reddit" }}
-
- {{ with (index . 1) }}
- {{ $label = . }}
- {{ end }}
-
- <a rel="me nofollow" href="{{ $url }}" title="{{ $label }}">
- <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
- <use xlink:href="{{ $icons }}#reddit"/>
- </svg>
+ {{ end }}
- <p>{{ $label }}</p>
- </a>
-
- {{ end }}
-
-
- {{ with or $centralizedOnPage.stackOverflow $centralizedOnSite.stackOverflow }}
-
- {{ $url := (index . 0) }}
- {{ $label := "Stack Overflow" }}
-
- {{ with (index . 1) }}
- {{ $label = . }}
- {{ end }}
-
- <a rel="me nofollow" href="{{ $url }}" title="{{ $label }}">
- <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
- <use xlink:href="{{ $icons }}#stack-overflow"/>
- </svg>
+ {{ else }}
- <p>{{ $label }}</p>
- </a>
-
- {{ end }}
-
+ {{ if (index (or $decentralizedOnPage $decentralizedOnSite) $currentEntry) }}
- {{ with or $centralizedOnPage.telegram $centralizedOnSite.telegram }}
-
- {{ $url := (index . 0) }}
- {{ $label := "Telegram" }}
-
- {{ with (index . 1) }}
- {{ $label = . }}
- {{ end }}
-
- <a rel="me nofollow" href="{{ $url }}" title="{{ $label }}">
- <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
- <use xlink:href="{{ $icons }}#telegram"/>
- </svg>
+ {{ range (index (or $decentralizedOnPage $decentralizedOnSite) $currentEntry) }}
+ <a rel="me nofollow" href="{{ index . 0 }}" title="{{ printf "%s (%s)" (index . 1) $currentLabel }}">
+ <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
+ <use xlink:href="{{ printf "%s#%s" $icons $currentIcon }}"/>
+ </svg>
- <p>{{ $label }}</p>
- </a>
-
- {{ end }}
-
- {{ with or $centralizedOnPage.twitter $centralizedOnSite.twitter }}
-
- {{ $url := (index . 0) }}
- {{ $label := "Twitter" }}
-
- {{ with (index . 1) }}
- {{ $label = . }}
+ <p>{{ index . 1 | truncate 15 }}</p>
+ </a>
+ {{ end }}
+
+ {{ end }}
+
{{ end }}
-
- <a rel="me nofollow" href="{{ $url }}" title="{{ $label }}">
- <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
- <use xlink:href="{{ $icons }}#twitter"/>
- </svg>
- <p>{{ $label }}</p>
- </a>
-
{{ end }}
</section> \ No newline at end of file