refactor: Change FontAwesome icon embed to partial template

This commit is contained in:
Thomas A. Christensen II 2024-12-01 18:33:39 -07:00
parent 478a7f8af7
commit e7972cfd81
Signed by: millironx
GPG key ID: B7044A3432851F64
7 changed files with 24 additions and 44 deletions

View file

@ -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 {

View file

@ -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

View file

@ -15,10 +15,7 @@
<div class="card-header">
<div class="thumb-icon-wrapper">
<span class="thumb-icon-badge">
{{- $fontAwesomePath := print "assets/graphics/fa/" . ".svg" -}}
<span class="fa-container fa-fw">
{{- readFile $fontAwesomePath | safeHTML -}}
</span>
{{- partial "fa.html" . -}}
</span>
</div>
</div>
@ -63,9 +60,9 @@
<a
href="{{ .RelPermalink }}"
class="card-link {{ if eq .LinkTitle "Thomas A. Christensen II" }}
fw-bolder
bolder
{{ end }}"
><i class="fad fa-user"></i> {{ .LinkTitle }}</a
>{{- partial "fa.html" "user" }} {{ .LinkTitle }}</a
>
{{ end }}
@ -82,7 +79,7 @@
<div class="card-footer">
{{ range (.GetTerms "tags") }}
<a href="{{ .RelPermalink }}" class="icon-link card-link"
><i class="fad fa-tag"></i> {{ .LinkTitle }}</a
>{{- partial "fa.html" "tag" }} {{ .LinkTitle }}</a
>
{{ end }}
</div>

View file

@ -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 }}
<a
@ -16,7 +16,7 @@
href="{{ .RelPermalink }}"
title="{{ humanize $category }}"
>
<i class="{{ $categoryIcon | default "fad fa-tag" }} fa-fw"></i>
{{- partial "fa.html" $categoryIcon -}}
</a>
{{ end }}
{{ end }}

4
layouts/partials/fa.html Normal file
View file

@ -0,0 +1,4 @@
{{- $fontAwesomePath := print "assets/graphics/fa/" . ".svg" -}}
<span class="fa-container fa-fw">
{{- readFile $fontAwesomePath | safeHTML -}}
</span>

View file

@ -7,13 +7,7 @@
class="{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}"
href="{{ .URL }}"
>
{{- $fontAwesomePath := print "assets/graphics/fa/" .Params.icon ".svg" -}}
<span
class="fa-container
fa-fw"
>
{{- readFile $fontAwesomePath | safeHTML -}}
</span>
{{- partial "fa.html" .Params.icon -}}
{{ .Name }}
</a>
{{ end }}

View file

@ -1,13 +1,2 @@
{{- $faName := .Get 0 -}}
{{- $isFullWidth := .Get 1 -}}
{{- $fontAwesomePath := print "assets/graphics/fa/" $faName ".svg" -}}
<span
class="fa-container{{- if eq $isFullWidth "yes" }}
fa-fw
{{ end -}}"
>
{{- readFile $fontAwesomePath | safeHTML -}}
</span>
{{- partial "fa.html" $faName -}}