From 8a0915bb81d1869a2217d8efc9548e1b4b925037 Mon Sep 17 00:00:00 2001 From: Reorx Date: Wed, 13 Apr 2022 21:09:58 +0800 Subject: change the way svg icon is get use data instead of if else in partial, this makes iterating and display all the icons possible --- layouts/partials/home_info.html | 2 +- layouts/partials/index_profile.html | 4 +- layouts/partials/social_icons.html | 5 +- layouts/partials/svg.html | 532 ------------------------------------ 4 files changed, 6 insertions(+), 537 deletions(-) delete mode 100644 layouts/partials/svg.html (limited to 'layouts') diff --git a/layouts/partials/home_info.html b/layouts/partials/home_info.html index eb55364..b9d7df9 100644 --- a/layouts/partials/home_info.html +++ b/layouts/partials/home_info.html @@ -7,7 +7,7 @@

{{ .Content | markdownify }}

{{- end -}} diff --git a/layouts/partials/index_profile.html b/layouts/partials/index_profile.html index 1bb2079..24e34fd 100644 --- a/layouts/partials/index_profile.html +++ b/layouts/partials/index_profile.html @@ -29,7 +29,7 @@ {{- end }}

{{ .title | default site.Title | markdownify }}

{{ .subtitle | markdownify }} - {{- partial "social_icons.html" site.Params.socialIcons -}} + {{- partial "social_icons.html" (dict "icons" site.Params.socialIcons "svg" $.Site.Data.svg) -}} {{- with .buttons }}
@@ -42,4 +42,4 @@ {{- end }}
{{- end}} - \ No newline at end of file + diff --git a/layouts/partials/social_icons.html b/layouts/partials/social_icons.html index 7c16e30..62e156c 100644 --- a/layouts/partials/social_icons.html +++ b/layouts/partials/social_icons.html @@ -1,7 +1,8 @@
- {{- range . }} + {{- range .icons }} - {{ partial "svg.html" . }} + {{- $icon_name := ( trim .name " " | lower )}} + {{ safeHTML (index $.svg $icon_name | default $.svg.default) }} {{- end }}
diff --git a/layouts/partials/svg.html b/layouts/partials/svg.html deleted file mode 100644 index a1b598e..0000000 --- a/layouts/partials/svg.html +++ /dev/null @@ -1,532 +0,0 @@ -{{- $icon_name := ( trim .name " " | lower )}} -{{- if (eq $icon_name "123rf") -}} - - - - -{{- else if (eq $icon_name "adobestock") -}} - - - - -{{- else if (eq $icon_name "applemusic") -}} - - - -{{- else if (eq $icon_name "behance") -}} - - - -{{- else if (eq $icon_name "bilibili") -}} - - - - - - - -{{- else if (eq $icon_name "buymeacoffee") -}} - - - - - - - - - - - - - - - - -{{- else if (eq $icon_name "codepen") -}} - - - - - - - -{{- else if (eq $icon_name "cryptohack") -}} - - - - - - -{{- else if (eq $icon_name "ctftime") -}} - - - - - - -{{- else if (eq $icon_name "cv") -}} - - - - - - -{{- else if (eq $icon_name "dev") -}} - - - -{{- else if (eq $icon_name "deezer") -}} - - - -{{- else if (eq $icon_name "discogs") -}} - - - -{{- else if (eq $icon_name "discord") -}} - - - - -{{- else if (eq $icon_name "dreamstime") -}} - - - -{{- else if (eq $icon_name "dribbble") -}} - - - - - -{{- else if (eq $icon_name "email") -}} - - - - -{{- else if (eq $icon_name "facebook") -}} - - - -{{- else if (eq $icon_name "flickr") -}} - - - -{{- else if (eq $icon_name "freepik") -}} - - - - - - -{{- else if (eq $icon_name "gitea") -}} - - - -{{- else if (eq $icon_name "github") -}} - - - - -{{- else if (eq $icon_name "github-simple") -}} -GitHub -{{- else if (eq $icon_name "gitlab") -}} - - - - -{{- else if (eq $icon_name "goodreads") -}} - - - -{{- else if (eq $icon_name "googlescholar") -}} - - - -{{- else if (eq $icon_name "hackerone") -}} - - - -{{- else if (eq $icon_name "hackerrank") -}} - - - - - - -{{- else if (eq $icon_name "hackthebox") -}} - - - - - - -{{- else if (eq $icon_name "instagram") -}} - - - - - -{{- else if (eq $icon_name "itchio") -}} - - - -{{- else if (eq $icon_name "kaggle") -}} - - - -{{- else if (eq $icon_name "kakaotalk") -}} - - - - - - - -{{- else if (eq $icon_name "keybase") -}} - - - -{{- else if (eq $icon_name "kofi") -}} - - - -{{- else if (eq $icon_name "komoot") -}} - - - -{{- else if (eq $icon_name "lastfm") -}} - - - -{{- else if (eq $icon_name "letterboxd") -}} - - - -{{- else if (eq $icon_name "liberapay") -}} - - - - - - -{{- else if (eq $icon_name "linkedin") -}} - - - - - -{{- else if (eq $icon_name "mastodon") -}} - - - - -{{- else if (eq $icon_name "matrix") -}} - - - -{{- else if (eq $icon_name "medium") -}} - - - - - -{{- else if (eq $icon_name "mixcloud") -}} - - - -{{- else if (eq $icon_name "nuget") -}} - - - - - - - - -{{- else if (eq $icon_name "paypal") -}} - - - -{{- else if or (eq $icon_name "pgpkey") (eq $icon_name "key") -}} - - - - -{{- else if (eq $icon_name "phone") -}} - - - - - -{{- else if (eq $icon_name "polywork") -}} - -{{- else if (eq $icon_name "qq") -}} - - - - -{{- else if (eq $icon_name "reddit") -}} - - - -{{- else if (eq $icon_name "researchgate") -}} - - - -{{- else if (eq $icon_name "rss") -}} - - - - - -{{- else if (eq $icon_name "rss-simple") -}} -RSS -{{- else if (eq $icon_name "serverfault") -}} - - - -{{- else if (eq $icon_name "soundcloud") -}} - - - -{{- else if (eq $icon_name "shutterstock") -}} - - - - -{{- else if (eq $icon_name "slack") -}} - - - - - - - -{{- else if (eq $icon_name "snapchat") -}} - - - -{{- else if (eq $icon_name "sourcerer") -}} - - - - - - - - - - - - -{{- else if (eq $icon_name "spotify") -}} - - - -{{- else if (eq $icon_name "stackoverflow") -}} - - - -{{- else if (eq $icon_name "steam") -}} - - - -{{- else if (eq $icon_name "telegram") -}} - - - -{{- else if (eq $icon_name "telegram-simple") -}} -Telegram -{{- else if (eq $icon_name "twitch") -}} - - - -{{- else if (eq $icon_name "twitter") -}} - - - - -{{- else if (eq $icon_name "twitter-simple") -}} -Twitter -{{- else if (eq $icon_name "unsplash") -}} - - - - -{{- else if (eq $icon_name "xda") -}} - - - -{{- else if (eq $icon_name "xing") -}} - - - - -{{- else if (eq $icon_name "ycombinator") -}} - - - -{{- else if (eq $icon_name "youtube") -}} - - - - - -{{- else if (eq $icon_name "pinboard-simple") -}} -Pinboard -{{- else if $icon_name -}} - - - - -{{- end -}} -- cgit v1.2.3