Shortcodes: Add font-awesome shortcode
This commit is contained in:
parent
3b1d00f685
commit
554d505239
|
@ -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 >}}
|
||||||
|
```
|
||||||
|
|
6
layouts/shortcodes/fa.html
Normal file
6
layouts/shortcodes/fa.html
Normal 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>
|
Loading…
Reference in a new issue