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:
authorRaphael Aguiar <rmaguiar@tuta.io>2020-08-19 21:20:02 +0300
committerRaphael Aguiar <rmaguiar@tuta.io>2020-08-19 21:20:02 +0300
commit89be9f2f21c64c12d677128381c2b6dd3d6b1bbf (patch)
tree8099494854cb0d649f2a1aa85eb9a99e1b7fea41
parent07bcfd77b6a1e01ffd59c11295abb201f81c01c5 (diff)
Fix #2 by checking if social params exist
-rw-r--r--layouts/_default/baseof.html2
-rw-r--r--layouts/partials/head.html31
-rw-r--r--layouts/shortcodes/social.html76
3 files changed, 56 insertions, 53 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 08d1f35..b6b0682 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -43,7 +43,7 @@
<!-- Additional symbols -->
{{ end }}
- {{ if .HasShortcode "social" }}
+ {{ if and (.HasShortcode "social") .Site.Params.Social }}
<!-- Get info about social platform and icon id from "social.json" -->
{{ range .Site.Data.social }}
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 20eb603..acd3467 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -250,30 +250,31 @@
<!-- Generate array with social profiles -->
{{ $sameAs := slice }}
-{{ range .Site.Data.social }}
+{{ if .Site.Params.Social }}
+ {{ range .Site.Data.social }}
- {{ $currentEntry := .entry }}
- {{ $currentBase := .base }}
+ {{ $currentEntry := .entry }}
+ {{ $currentBase := .base }}
- {{ if not .decentralized }}
+ {{ if not .decentralized }}
- {{ with (index $centralized $currentEntry) }}
- {{ $sameAs = $sameAs | append (printf "%s%s" $currentBase (index . 0)) }}
- {{ end }}
+ {{ with (index $centralized $currentEntry) }}
+ {{ $sameAs = $sameAs | append (printf "%s%s" $currentBase (index . 0)) }}
+ {{ end }}
+
+ {{ else }}
- {{ else }}
-
- {{ if (index $decentralized $currentEntry) }}
- {{ range (index $decentralized $currentEntry) }}
- {{ $sameAs = $sameAs | append (index . 0) }}
+ {{ if (index $decentralized $currentEntry) }}
+ {{ range (index $decentralized $currentEntry) }}
+ {{ $sameAs = $sameAs | append (index . 0) }}
+ {{ end }}
{{ end }}
+
{{ end }}
-
- {{ end }}
+ {{ end }}
{{ end }}
-
<!-- Schema Markup / Structured Data -->
<!--
diff --git a/layouts/shortcodes/social.html b/layouts/shortcodes/social.html
index 4b11574..b86c066 100644
--- a/layouts/shortcodes/social.html
+++ b/layouts/shortcodes/social.html
@@ -1,55 +1,57 @@
-<!-- Reduce repetition... -->
-{{ $centralized := $.Site.Params.Social.Centralized }}
-{{ $decentralized := $.Site.Params.Social.Decentralized }}
+{{ if .Site.Params.Social }}
+ <!-- Reduce repetition... -->
+ {{ $centralized := $.Site.Params.Social.Centralized }}
+ {{ $decentralized := $.Site.Params.Social.Decentralized }}
-<section class="social">
+ <section class="social">
- {{ range .Site.Data.social }}
+ {{ range .Site.Data.social }}
- {{ $currentEntry := .entry }}
- {{ $currentLabel := .label }}
- {{ $currentBase := .base }}
- {{ $currentIcon := .icon.id }}
+ {{ $currentEntry := .entry }}
+ {{ $currentLabel := .label }}
+ {{ $currentBase := .base }}
+ {{ $currentIcon := .icon.id }}
- {{ if not .decentralized }}
+ {{ if not .decentralized }}
- {{ with (index $centralized $currentEntry) }}
+ {{ with (index $centralized $currentEntry) }}
- {{ $url := printf "%s%s" $currentBase (index . 0) }}
- {{ $label := $currentLabel }}
-
- {{ with (index . 1) }}
- {{ $label = . }}
- {{ end }}
+ {{ $url := printf "%s%s" $currentBase (index . 0) }}
+ {{ $label := $currentLabel }}
- <a class="btn" href="{{ $url }}" rel="me nofollow" title="{{ $label }}">
- <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
- <use xlink:href="#{{ $currentIcon }}"/>
- </svg>
+ {{ with (index . 1) }}
+ {{ $label = . }}
+ {{ end }}
+
+ <a class="btn" href="{{ $url }}" rel="me nofollow" title="{{ $label }}">
+ <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
+ <use xlink:href="#{{ $currentIcon }}"/>
+ </svg>
- <p>{{ $label }}</p>
- </a>
+ <p>{{ $label }}</p>
+ </a>
- {{ end }}
+ {{ end }}
- {{ else }}
+ {{ else }}
- {{ if (index $decentralized $currentEntry) }}
+ {{ if (index $decentralized $currentEntry) }}
- {{ range (index $decentralized $currentEntry) }}
- <a class="btn" href="{{ index . 0 }}" rel="me nofollow" title="{{ printf "%s (%s)" (index . 1) $currentLabel }}">
- <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
- <use xlink:href="#{{ $currentIcon }}"/>
- </svg>
+ {{ range (index $decentralized $currentEntry) }}
+ <a class="btn" href="{{ index . 0 }}" rel="me nofollow" title="{{ printf "%s (%s)" (index . 1) $currentLabel }}">
+ <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
+ <use xlink:href="#{{ $currentIcon }}"/>
+ </svg>
- <p>{{ index . 1 | truncate 15 }}</p>
- </a>
+ <p>{{ index . 1 | truncate 15 }}</p>
+ </a>
+ {{ end }}
+
{{ end }}
{{ end }}
-
- {{ end }}
- {{ end }}
+ {{ end }}
-</section> \ No newline at end of file
+ </section>
+{{ end }} \ No newline at end of file