Font Awesome icon support for section Icons - #829
Open
Nolram567 wants to merge 1 commit into
Open
Conversation
Owner
|
Hello! Thanks for the PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FontAwesome Icons for Section Icons
I really enjoy using this theme and am very happy with it. For my personal use, I implemented a small feature that allows FontAwesome icons to be used as section icons, similar to the existing
BookIconsfeature.This approach means that FontAwesome SVG files no longer need to be downloaded and added to the repository individually. Icons can simply be referenced by their CSS class name.
How it works
The icons are rendered using an
<i>element with the corresponding FontAwesome CSS classes. The element is marked witharia-hidden="true"so that screen readers will ignore the decorative icon.To enable the feature,
FontAwesomeneeds to be set totrueinhugo.toml:After enabling the feature, a section icon can be specified in the sections frontmatter, for example:
The corresponding FontAwesome icon will then be displayed as the section icon.
Features
BookIconsfunctionality to support FontAwesome icons for sections.book-iconCSS class for consistent styling and integration.hugo.toml, so the default configuration and existing behavior remain unchanged.This provides a simple way to use the large FontAwesome icon library without having to manage individual SVG files.
I have included an example image below.