From d203c5b32ac1d96783d7a0665feb96917c56ea5c Mon Sep 17 00:00:00 2001 From: Gabriele Musco Date: Thu, 15 Apr 2021 14:44:45 +0200 Subject: [PATCH] migrated icon from ugly switch to yaml dict --- data/supported_icons.yml | 18 +++++++++++++ layouts/partials/iconlink.html | 47 +++------------------------------- 2 files changed, 21 insertions(+), 44 deletions(-) create mode 100644 data/supported_icons.yml diff --git a/data/supported_icons.yml b/data/supported_icons.yml new file mode 100644 index 0000000..961a6d7 --- /dev/null +++ b/data/supported_icons.yml @@ -0,0 +1,18 @@ +email: "" +facebook: "" +github: "" +gitlab: "" +gnome: "" +instagram: "" +linkedin: "" +mastodon: "" +matrix: "" +peertube: "" +phone: "" +pleroma: "" +rss: "" +steam: "" +telegram: "" +twitter: "" +xmpp: "ﳽ" +youtube: "" diff --git a/layouts/partials/iconlink.html b/layouts/partials/iconlink.html index c8dc872..4c489d9 100644 --- a/layouts/partials/iconlink.html +++ b/layouts/partials/iconlink.html @@ -3,50 +3,9 @@ target="_blank" class="nerdlink" href="{{ .URL }}"> - {{ if eq $id "gitlab" }} -  - {{ else if eq $id "gnome" }} -  - {{ else if eq $id "youtube" }} -  - {{ else if eq $id "email" }} -  - {{ else if eq $id "twitter" }} -  - {{ else if eq $id "instagram" }} -  - {{ else if eq $id "facebook" }} -  - {{ else if eq $id "github" }} -  - {{ else if eq $id "linkedin" }} -  - {{ else if eq $id "telegram" }} -  - {{ else if eq $id "xmpp" }} - ﳽ - {{ else if eq $id "steam" }} -  - {{ else if eq $id "pleroma" }} - - - - {{ else if eq $id "peertube" }} - - - - {{ else if eq $id "matrix" }} - - - - {{ else if eq $id "mastodon" }} - - - - {{ else if eq $id "phone" }} -  - {{ else if eq $id "rss" }} -  + {{ $icon := index site.Data.supported_icons $id | safeHTML }} + {{ if $icon }} + {{ $icon | safeHTML }} {{ else }} {{ .Name }} {{ end }}