Icons
Add inline SVG icons using widgets/icon.html partial.
This is partial implementation of icons, if you are looking for the shortcode version, check Icons documentation.
Features#
- Adds Inline Font Awesome SVGs.
- Adds accessible attributes (
role="img"andaria-label) for screen readers.
Parameters#
- name#
- (required) Font Awesome icon filename (e.g.
github,lightbulb,circle-info). - style#
- (optional)
solid|regular|brands(default:solid). - class#
- (optional) Additional CSS classes to append to the SVG.
- ariaLabel#
- (optional) Accessible label for screen readers (defaults to the icon
name).
Icons are fetched from Font Awesome free catalog. Check below links for supported icons in each style:
Syntax#
go-html-template
{{
partial "widgets/icon.html" (dict
"name" "github"
"style" "brands"
"class" "my-icon"
"ariaLabel" "GitHub profile"
)
}}Examples#
Below is a quick reference table showing common icon partial calls and their rendered output.
| code | icon |
|---|---|
{{ partial "widgets/icon.html" (dict "name" "lightbulb") }} | |
{{ partial "widgets/icon.html" (dict "name" "heart" "class" "text-danger") }} | |
{{ partial "widgets/icon.html" (dict "name" "envelope" "style" "regular" "ariaLabel" "Email") }} | |
{{ partial "widgets/icon.html" (dict "name" "github" "style" "brands" "ariaLabel" "GitHub") }} | |
{{ partial "widgets/icon.html" (dict "name" "twitter" "style" "brands" "ariaLabel" "Twitter") }} |