From e7972cfd81ba52cddd535a90211f486c5e1a450a Mon Sep 17 00:00:00 2001 From: "Thomas A. Christensen II" <25492070+MillironX@users.noreply.github.com> Date: Sun, 1 Dec 2024 18:33:39 -0700 Subject: [PATCH] refactor: Change FontAwesome icon embed to partial template --- assets/styles/millironx.css | 5 +---- content/_index.md | 13 ++++++------- layouts/_default/list.html | 11 ++++------- layouts/partials/category-button.html | 14 +++++++------- layouts/partials/fa.html | 4 ++++ layouts/partials/sidebar.html | 8 +------- layouts/shortcodes/fa.html | 13 +------------ 7 files changed, 24 insertions(+), 44 deletions(-) create mode 100644 layouts/partials/fa.html diff --git a/assets/styles/millironx.css b/assets/styles/millironx.css index 25a0fc4..1e620de 100644 --- a/assets/styles/millironx.css +++ b/assets/styles/millironx.css @@ -257,11 +257,8 @@ footer { box-sizing: content-box; display: inline-block; height: 1em; - vertical-align: -0.125em; -} - -.fa-container.fa-fw svg { width: 1.25em; + vertical-align: -0.125em; } .fa-container svg path { diff --git a/content/_index.md b/content/_index.md index 4710eb4..b7cd16c 100644 --- a/content/_index.md +++ b/content/_index.md @@ -62,16 +62,15 @@ stories. Around the web you can find me at (in order of subjective importance) -- {{< fa github yes >}} GitHub: [@MillironX](https://github.com/MillironX) -- {{< fa orcid yes >}} ORDiD: +- {{< fa github >}} GitHub: [@MillironX](https://github.com/MillironX) +- {{< fa orcid >}} ORDiD: [0000-0003-1219-9320](https://orcid.org/0000-0003-1219-9320) -- {{< fa gitlab yes >}} GitLab: [@MillironX](https://gitlab.com/MillironX) -- {{< fa vimeo yes >}} Vimeo: +- {{< fa gitlab >}} GitLab: [@MillironX](https://gitlab.com/MillironX) +- {{< fa vimeo >}} Vimeo: [Thomas Christensen II](https://vimeo.com/tchristensenii) -- {{< fa stack-overflow yes >}} StackExchange: +- {{< fa stack-overflow >}} StackExchange: [Milliron X](https://stackexchange.com/users/4863541/milliron-x) -- {{< fa steam yes >}} Steam: - [MillironX](https://steamcommunity.com/id/millironx) +- {{< fa steam >}} Steam: [MillironX](https://steamcommunity.com/id/millironx) This list is intended to verify my identity on other sites. Please do _not_ use it as fodder to try and "follow" me on each of these platforms. I stand with diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 8f63516..8c79f98 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -15,10 +15,7 @@
- {{- $fontAwesomePath := print "assets/graphics/fa/" . ".svg" -}} - - {{- readFile $fontAwesomePath | safeHTML -}} - + {{- partial "fa.html" . -}}
@@ -63,9 +60,9 @@ {{ .LinkTitle }}{{- partial "fa.html" "user" }} {{ .LinkTitle }} {{ end }} @@ -82,7 +79,7 @@ diff --git a/layouts/partials/category-button.html b/layouts/partials/category-button.html index b54d5ba..5b5d7e7 100644 --- a/layouts/partials/category-button.html +++ b/layouts/partials/category-button.html @@ -3,12 +3,12 @@ {{ if eq $i 0 }} {{ with $.Site.GetPage (printf "/%s/%s" "categories" $category) }} {{ $iconDictionary := dict - "video" "fad fa-video" - "paper" "fad fa-book" - "poster" "fad fa-presentation" - "thesis" "fad fa-graduation-cap" - "presentation" "fad fa-podium" - "web" "fad fa-globe" + "video" "video" + "paper" "book" + "poster" "presentation" + "thesis" "graduation-cap" + "presentation" "podium" + "web" "globe" }} {{ $categoryIcon := index $iconDictionary $category }} - + {{- partial "fa.html" $categoryIcon -}} {{ end }} {{ end }} diff --git a/layouts/partials/fa.html b/layouts/partials/fa.html new file mode 100644 index 0000000..540a166 --- /dev/null +++ b/layouts/partials/fa.html @@ -0,0 +1,4 @@ +{{- $fontAwesomePath := print "assets/graphics/fa/" . ".svg" -}} + + {{- readFile $fontAwesomePath | safeHTML -}} + diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index a9e2049..483f7f8 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -7,13 +7,7 @@ class="{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}" href="{{ .URL }}" > - {{- $fontAwesomePath := print "assets/graphics/fa/" .Params.icon ".svg" -}} - - {{- readFile $fontAwesomePath | safeHTML -}} - + {{- partial "fa.html" .Params.icon -}} {{ .Name }} {{ end }} diff --git a/layouts/shortcodes/fa.html b/layouts/shortcodes/fa.html index 73663c8..454b184 100644 --- a/layouts/shortcodes/fa.html +++ b/layouts/shortcodes/fa.html @@ -1,13 +1,2 @@ {{- $faName := .Get 0 -}} -{{- $isFullWidth := .Get 1 -}} - -{{- $fontAwesomePath := print "assets/graphics/fa/" $faName ".svg" -}} - - - - {{- readFile $fontAwesomePath | safeHTML -}} - +{{- partial "fa.html" $faName -}}