From 55f6057a355984b7d4fe8c835d8224b74233b7d7 Mon Sep 17 00:00:00 2001 From: Zachary Rohrbach Date: Wed, 23 Dec 2020 15:18:21 -0500 Subject: [PATCH] ranged through an array to make social-follow.html more efficient --- layouts/partials/social-follow.html | 90 ++++------------------------- 1 file changed, 12 insertions(+), 78 deletions(-) diff --git a/layouts/partials/social-follow.html b/layouts/partials/social-follow.html index 0755ce2..8e09334 100644 --- a/layouts/partials/social-follow.html +++ b/layouts/partials/social-follow.html @@ -1,80 +1,14 @@ {{ $icon_size := "32px" }} -{{ with .Param "stackoverflow" }} - - {{ partial "svg/stackoverflow.svg" (dict "size" $icon_size) }} - {{- partial "new-window-icon.html" . -}} - -{{ end }} -{{ with .Param "facebook" }} - - {{ partial "svg/facebook.svg" (dict "size" $icon_size) }} - {{- partial "new-window-icon.html" . -}} - -{{ end }} -{{ with .Param "twitter" }} - - {{ partial "svg/twitter.svg" (dict "size" $icon_size) }} - {{- partial "new-window-icon.html" . -}} - -{{ 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 }} +{{ $social_media := slice "stackoverflow" "facebook" "twitter" "instagram" "youtube" "linkedin" "github" "gitlab" "keybase" "medium" "mastodon" "slack" "rss" }} +{{ $dot_passthrough := . }} + +{{ range $social_media }} + {{ $this_key := . }} + {{ with $dot_passthrough.Param . }} + + {{ partial (print "svg/" $this_key ".svg") (dict "size" $icon_size) }} + {{- partial "new-window-icon.html" . -}} + + {{ end }} +{{ end }} \ No newline at end of file