- Messages
- 5,045
- Website
- www.xenfocus.com
Custom FontAwesome Icons
To assign different FontAwesome icons to different nodes, you first need to know the id of your node, and the unicode value of your FontAwesome icon.
The node id can typically be found in the URL. On this site, the client area URL is:
The id for this is 13, as seen at the end of that URL.
The icon which I want to use is a bell.
So, to change the icon for the Client Lounge on this site, I would add the following to extra.less
Using images as node icons
Instead of using FontAwesome icons, you can use images as node icons. Each node can use its own image if necessary, and a fallback image will be used for nodes which don't have their own icon. To begin, you'll first need to specify the fallback image for your node icons. This can be done under Style Properties > Node Icons > Image Path (new content). Adding a URL or path to this setting will remove the FontAwesome icons and replace them with your image.
An optional "no new content" image can be specified which will be used on nodes which have no new content. If no image is provided, a faint, grayscale version of your default image will be used.
To customize each node with its own image, add the following to extra.less and customize the 13 (make sure to edit both instances) and the url. This example will use the same node ID as the FontAwesome steps above: node 13.
To use custom node images for multiple forums, follow the pattern below:
To assign different FontAwesome icons to different nodes, you first need to know the id of your node, and the unicode value of your FontAwesome icon.
The node id can typically be found in the URL. On this site, the client area URL is:
Code:
https://xenfocus.com/community/forums/customer-lounge.13/
The id for this is 13, as seen at the end of that URL.
The icon which I want to use is a bell.
So, to change the icon for the Client Lounge on this site, I would add the following to extra.less
Less:
#XF{
.node--id13 .node-icon i{
&::before{
.m-faContent(@fa-var-bell);
}
svg{
display: none;
}
}
}
Using images as node icons
Instead of using FontAwesome icons, you can use images as node icons. Each node can use its own image if necessary, and a fallback image will be used for nodes which don't have their own icon. To begin, you'll first need to specify the fallback image for your node icons. This can be done under Style Properties > Node Icons > Image Path (new content). Adding a URL or path to this setting will remove the FontAwesome icons and replace them with your image.
An optional "no new content" image can be specified which will be used on nodes which have no new content. If no image is provided, a faint, grayscale version of your default image will be used.
To customize each node with its own image, add the following to extra.less and customize the 13 (make sure to edit both instances) and the url. This example will use the same node ID as the FontAwesome steps above: node 13.
Less:
#XF .node--id13 .node-icon i::before,
#XF .node--id13 .node-icon i svg{
display: none;
}
#XF .node--id13 .node-icon i{
background-image: url('https://site.com/images/node-icons/node-icon-13.png');
}
#XF[data-logged-in='true'] .node--id13.node--read .node-icon i{
filter: @node-icon-read-filter;
opacity: @node-icon-read-opacity;
}
To use custom node images for multiple forums, follow the pattern below:
Less:
#XF .node--id13 .node-icon i{
background-image: url('https://site.com/images/node-icons/node-icon-13.png');
}
#XF .node--id14 .node-icon i{
background-image: url('https://site.com/images/node-icons/node-icon-14.png');
}
#XF .node--id15 .node-icon i{
background-image: url('https://site.com/images/node-icons/node-icon-15.png');
}
#XF .node--id13 .node-icon i::before,
#XF .node--id13 .node-icon i svg,
#XF .node--id14 .node-icon i::before,
#XF .node--id14 .node-icon i svg,
#XF .node--id15 .node-icon i::before,
#XF .node--id15 .node-icon i svg
{
display: none;
}
#XF[data-logged-in='true'] .node--id13.node--read .node-icon i,
#XF[data-logged-in='true'] .node--id14.node--read .node-icon i,
#XF[data-logged-in='true'] .node--id15.node--read .node-icon i{
filter: @node-icon-read-filter;
opacity: @node-icon-read-opacity;
}
Last edited: