diff options
author | fncnt <github@vncnt.eu> | 2021-05-18 21:48:42 +0300 |
---|---|---|
committer | fncnt <github@vncnt.eu> | 2021-05-18 21:48:42 +0300 |
commit | 9bf0d6acb1554da2f958a7d0037156760eed5d81 (patch) | |
tree | cdfbd5ca17962dbb0d08c13ffd2fa8b8e1482e49 | |
parent | 02e869439e8bfca892745658e8a7679e9800892a (diff) |
Allow other fontawesome classes
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | config.toml | 1 | ||||
-rw-r--r-- | exampleSite/config.toml | 1 | ||||
-rw-r--r-- | layouts/partials/body.html | 8 |
4 files changed, 14 insertions, 1 deletions
@@ -30,6 +30,11 @@ Please note that the key must correspond to a [fontawesome brands icon](https:// Also, regardless of the key order in your `config.toml` file, the links will be ordered lexicographically due to the usage of [`range`](https://golang.org/pkg/text/template/#hdr-Actions). However, those are trade-offs I'm willing to accept for simplicity. +You may specify another `fontawesome` icon and class like this: +``` +mountain = [ "https://local-hiking.club", "fas" ] +``` + ## Third-party Components The spine (I'm so sorry) of this theme is made of [`Barebones`](https://github.com/acahir/Barebones). diff --git a/config.toml b/config.toml index 9aa9baf..710ca1a 100644 --- a/config.toml +++ b/config.toml @@ -33,3 +33,4 @@ title = "John Doe · Landing Page" instagram = "https://instagram.com/jdoe" twitter = "https://twitter.com/jdoe" ello = "" + hiking = [ "https://local-hiking.club", "fas" ] diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 9aa9baf..710ca1a 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -33,3 +33,4 @@ title = "John Doe · Landing Page" instagram = "https://instagram.com/jdoe" twitter = "https://twitter.com/jdoe" ello = "" + hiking = [ "https://local-hiking.club", "fas" ] diff --git a/layouts/partials/body.html b/layouts/partials/body.html index b0bd887..03ffb06 100644 --- a/layouts/partials/body.html +++ b/layouts/partials/body.html @@ -16,8 +16,14 @@ {{ with .Site.Params.email }}<a class="icon" href="mailto:{{ . }}" target="_blank" rel="noopener me"> <i class="fas fa-envelope" title="email" aria-label="Send email."></i> </a>{{ end }} - {{ range $contact_key, $contact_link := .Site.Params.contact }}<a class="icon" href="{{ $contact_link }}" target="_blank" rel="noopener me"> + {{ range $contact_key, $contact_link := .Site.Params.contact }} + {{ if in (slice "fab" "fas" "far" "fal" "fad") (index $contact_link 1) }} + <a class="icon" href="{{ index $contact_link 0 }}" target="_blank" rel="noopener me"> + <i class="{{ index $contact_link 1 }} fa-{{ $contact_key }}" title="{{ $contact_key }}" aria-label="Go to {{ $contact_key }}."></i> + {{ else }} + <a class="icon" href="{{ $contact_link }}" target="_blank" rel="noopener me"> <i class="fab fa-{{ $contact_key }}" title="{{ $contact_key }}" aria-label="Go to {{ $contact_key }}."></i> + {{ end }} </a>{{ end }} </h2> </div> |