Shortcodes: Add font-awesome shortcode

This commit is contained in:
jtbx 2023-10-02 12:09:39 +02:00
parent 3b1d00f685
commit 554d505239
2 changed files with 14 additions and 0 deletions

View file

@ -61,3 +61,11 @@ To create a new general blog post, run a command like this:
```shell ```shell
hugo new content --king article blog/your-article-title.md hugo new content --king article blog/your-article-title.md
``` ```
### Icons
You can use solid and brand icons from https://fontawesome.com/icons version 6 in your posts like this:
```md
{{< fa envelope >}}
{{< fa brands gitlab >}}
```

View file

@ -0,0 +1,6 @@
<!-- use default fontawesome class 'fas' or use a specified one like 'fab' for brands -->
{{- $faStylePrefix := "fa-solid" }}
{{- if in (slice "fa-solid" "fa-brands") (.Get 0) }}
{{- $faStylePrefix = (.Get 0) }}
{{- end }}
<i class="{{ $faStylePrefix }} {{ range $iconName := .Params }} fa-{{ $iconName }} {{ end }}"></i>