Generate footer_social.html from social.toml data

This commit is contained in:
vimux 2018-12-22 09:00:08 -05:00
parent c0c65c8fa6
commit a11f2684bc
No known key found for this signature in database
GPG key ID: 5A34FDC4EE832E34
2 changed files with 84 additions and 65 deletions

77
data/social.toml Normal file
View file

@ -0,0 +1,77 @@
[[icons]]
id = "email"
url = "mailto:%s"
icon = "svg/email.svg"
weight = 10
[[icons]]
id = "facebook"
url = "https://www.facebook.com/%s"
icon = "svg/facebook.svg"
weight = 20
[[icons]]
id = "twitter"
url = "https://twitter.com/%s"
icon = "svg/twitter.svg"
weight = 30
[[icons]]
id = "telegram"
url = "https://t.me/%s"
icon = "svg/telegram.svg"
weight = 40
[[icons]]
id = "instagram"
url = "https://www.instagram.com/%s"
icon = "svg/instagram.svg"
weight = 50
[[icons]]
id = "pinterest"
url = "https://www.pinterest.com/%s"
icon = "svg/pinterest.svg"
weight = 60
[[icons]]
id = "vk"
url = "https://vk.com/%s"
icon = "svg/vk.svg"
weight = 70
[[icons]]
id = "linkedin"
url = "https://linkedin.com/in/%s"
icon = "svg/linkedin.svg"
weight = 80
[[icons]]
id = "github"
url = "https://github.com/%s"
icon = "svg/github.svg"
weight = 90
[[icons]]
id = "gitlab"
url = "https://gitlab.com/%s"
icon = "svg/gitlab.svg"
weight = 100
[[icons]]
id = "stackoverflow"
url = "https://stackoverflow.com/users/%s"
icon = "svg/stackoverflow.svg"
weight = 110
[[icons]]
id = "mastodon"
url = "https://mastodon.social/@%s"
icon = "svg/mastodon.svg"
weight = 120
[[icons]]
id = "medium"
url = "https://medium.com/@%s"
icon = "svg/medium.svg"
weight = 130

View file

@ -1,69 +1,11 @@
{{ if .Site.Params.social }} {{- if .Site.Params.social }}
<div class="footer__social social"> <div class="footer__social social">
{{- with .Param "social.email" }} {{- range sort .Site.Data.social.icons "weight" }}
<a class="social__link" href="mailto:{{ . }}"> {{- if isset $.Site.Params.Social .id }}
{{ partial "svg/email.svg" (dict "class" "social__icon" ) }} <a class="social__link" target="_blank" rel="noopener noreferrer" href="{{ printf .url (index $.Site.Params.Social .id) }}">
{{ partial .icon (dict "class" "social__icon") }}
</a> </a>
{{- end }} {{- end }}
{{- with .Param "social.facebook" }}
<a class="social__link" target="_blank" rel="noopener noreferrer" href="https://www.facebook.com/{{ . }}">
{{ partial "svg/facebook.svg" (dict "class" "social__icon" ) }}
</a>
{{- end }}
{{- with .Param "social.twitter" }}
<a class="social__link" target="_blank" rel="noopener noreferrer" href="https://twitter.com/{{ . }}">
{{ partial "svg/twitter.svg" (dict "class" "social__icon" ) }}
</a>
{{- end }}
{{- with .Param "social.telegram" }}
<a class="social__link" target="_blank" rel="noopener noreferrer" href="https://t.me/{{ . }}">
{{ partial "svg/telegram.svg" (dict "class" "social__icon" ) }}
</a>
{{- end }}
{{- with .Param "social.instagram" }}
<a class="social__link" target="_blank" rel="noopener noreferrer" href="https://www.instagram.com/{{ . }}">
{{ partial "svg/instagram.svg" (dict "class" "social__icon" ) }}
</a>
{{- end }}
{{- with .Param "social.pinterest" }}
<a class="social__link" target="_blank" rel="noopener noreferrer" href="https://www.pinterest.com/{{ . }}">
{{ partial "svg/pinterest.svg" (dict "class" "social__icon" ) }}
</a>
{{- end }}
{{- with .Param "social.vk" }}
<a class="social__link" target="_blank" rel="noopener noreferrer" href="https://vk.com/{{ . }}">
{{ partial "svg/vk.svg" (dict "class" "social__icon" ) }}
</a>
{{- end }}
{{- with .Param "social.linkedin" }}
<a class="social__link" target="_blank" rel="noopener noreferrer" href="https://linkedin.com/in/{{ . }}">
{{ partial "svg/linkedin.svg" (dict "class" "social__icon" ) }}
</a>
{{- end }}
{{- with .Param "social.github" }}
<a class="social__link" target="_blank" rel="noopener noreferrer" href="https://github.com/{{ . }}">
{{ partial "svg/github.svg" (dict "class" "social__icon" ) }}
</a>
{{- end }}
{{- with .Param "social.gitlab" }}
<a class="social__link" target="_blank" rel="noopener noreferrer" href="https://gitlab.com/{{ . }}">
{{ partial "svg/gitlab.svg" (dict "class" "social__icon" ) }}
</a>
{{- end }}
{{- with .Param "social.stackoverflow" }}
<a class="social__link" target="_blank" rel="noopener noreferrer" href="https://stackoverflow.com/users/{{ . }}">
{{ partial "svg/stackoverflow.svg" (dict "class" "social__icon" ) }}
</a>
{{- end }}
{{- with .Param "social.mastodon" }}
<a class="social__link" target="_blank" rel="noopener noreferrer" href="https://mastodon.social/@{{ . }}">
{{ partial "svg/mastodon.svg" (dict "class" "social__icon" ) }}
</a>
{{- end }}
{{- with .Param "social.medium" }}
<a class="social__link" target="_blank" rel="noopener noreferrer" href="https://medium.com/@{{ . }}">
{{ partial "svg/medium.svg" (dict "class" "social__icon" ) }}
</a>
{{- end }} {{- end }}
</div> </div>
{{ end }} {{- end }}