social services icons support #6

This commit is contained in:
Dmitry Kolosov 2021-05-17 21:04:42 +03:00
parent dc52fdf1b0
commit 269283077f
27 changed files with 268 additions and 106 deletions

View file

@ -0,0 +1,15 @@
<span class="inline-svg" >
{{ $dict := newScratch }}
{{ if (eq .custom true) }}
{{ $dict.Set "filename" (print "static/fa-icons/" .iconName ".svg") }}
{{ else }}
{{ $dict.Set "filename" (print "themes/anubis/static/fa-icons/" .iconName ".svg") }}
{{ end }}
{{- $path:="<path" -}}
{{- $fill:="<path fill=\"currentColor\"" -}}
{{ replace (readFile ($dict.Get "filename")) $path $fill | safeHTML }}
</span>

View file

@ -1,6 +1,9 @@
<h1 class="site-title">
<a href="{{ .Site.BaseURL | relLangURL }}">{{ .Site.Title }}</a>
</h1>
<div class="header-top">
<h1 class="site-title">
<a href="{{ .Site.BaseURL | relLangURL }}">{{ .Site.Title }}</a>
</h1>
{{ partial "social.html" . }}
</div>
{{ if .Site.Menus.main }}
<nav>
{{ $currentPage := . }}
@ -12,4 +15,4 @@
<nav></nav>
{{ end }}
{{ partial "header-extra.html" . }}
{{ partial "header-extra.html" . }}

View file

@ -0,0 +1,19 @@
<ul class="social-icons">
{{ range $.Site.Params.Social }}
{{ if and (isset $.Site.Data.social.social_icons .id) (isset . "name") }}
{{ $url := index $.Site.Data.social.social_icons .id }}
<li>
<a href="{{ printf $url .name }}" title="{{ humanize .id }}" rel="me">
{{ partial "fontawesome.html" (dict "iconName" .id "custom" false) }}
</a>
</li>
{{ else if (isset . "url") }}
<li>
<a href="{{ printf .url }}" title="{{ humanize .id }}" rel="me">
{{ partial "fontawesome.html" (dict "iconName" .id "custom" true) }}
</a>
</li>
{{ end }}
{{ end }}
</ul>