Introducing Font Awesome 5 and SVG icons

Just reporting back a simple CSS solution that worked for me and coincides perfectly with my global navbar in wordpress:

I added the following to :

<link rel="stylesheet" href="" integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous">

My html in the “Header” looks like this:

    <a class="red" href=""><i style="margin-top: -1px;" class="fas fa-home fa-sm"></i><span>&nbsp; Home</span></a> 
    <a class="red" href=""><i style="margin-top: -1px;" class="fas fa-edit fa-sm"></i><span>&nbsp; Courses</span></a> 
    <a class="red" href=""><i style="margin-top: -1px;" class="fas fa-calendar-alt fa-sm"></i><span>&nbsp; Events</span></a>
    <a class="grn" href=""><i style="margin-top: -1px;" class="fas fa-comments fa-sm"></i><span>&nbsp; Community</span></a>
    <a class="grn" href=""><i style="margin-top: -1px;" class="fas fa-star fa-sm"></i><span>&nbsp; Resources</span></a>

Annnnnnd, my navbar FA icons are back!


This will make your site load both the SVG version of Font Awesome and the WebFont version, which will be a extra bytes (85kb).

Not to mention that the extra CSS (foreign to Discourse now) can break in weird ways in the future.


YOWZA! That’s not good to have all the extra bytes. Is there a way to prevent it from loading the SVG version as well? It was just so much easier to do this approach, and I just wanted my icons back up as quick as possible.

I think you need to do this the correct way rather than the “easy” way…


Wiser words have never been spoken! ツ

Thanks for the tip about the implications of the hacky approach I shared, @Falco. I’ll see if I can figure out how to do it the “correct” way when I have some time!


Since you’re adding the elements above the header, you can use the above-site-header plugin-outlet

Now, it’s very simple to do so, there’s more details here but the simple version is that you need to wrap your html in this

<script type="text/x-handlebars" data-template-name="/connectors/above-site-header/custom-menu">


Once you do that, you’ll be able to use the {{d-icon}} component. So instead of

<i class="fas fa-home fa-sm"></i>

you’d use

{{d-icon "home"}}

So you end up with this in the header section of your theme

<script type="text/x-handlebars" data-template-name="/connectors/above-site-header/custom-menu">
<div class="navbar">
  <a class="red" href="">
    {{d-icon "home"}}
  <a class="red" href="">
    {{d-icon "edit"}}
  <a class="red" href="">
    {{d-icon "calendar"}}
  <a class="grn" href="">
    {{d-icon "comment"}}
  <a class="red" href="#">
    {{d-icon "star"}}

and this small CSS rule

.navbar .d-icon {
  margin-right: 0.5em;

and that would create

Notice how there’s a couple of icons that are missing, well that happens because those icons you want to use are not included in the default set. FontAwesome 5 has tons of icons and there’s no point loading them if they’re not going to be used.

The missing icons are star and edit.

Adding icons to the set on your site is very simple. Search for the


setting in the admin, and add those there like so:

and go look at the header (after a page refresh) and all the icons should display nicely now


I’ve noticed some of the SVG icons look less elegant than their FontAwesome icon font equivalent.

Example SVG:


Example FA:


Is it possible for me to tweak the SVG rendering (e.g. stroke width in the above example) to improve their style?


I understand where you’re coming from but It actually has nothing to do with SVG icons V.S. font-file.

FontAwesome 5 changed a lot of icons. One of the icons that changed is the calendar icon in your screenshot.

Here’s what the calender icon looked like in FA4


Here are the two free options available for the calendar icon in FA5



and here’s what the FA5 pro - paid - calendar icon looks like



Thanks for the insight @Johani. I wonder if there are some nicer SVGs on offer elsewhere (assuming I can use CSS to substitute custom SVGs)

1 Like ?


Good shout @TheBestPessimist


I’m brand new to all of this. Is it possible to use icons for each catogery?

For example there is a :poop: posting section, so I’ve added fas fa-poop to the library.

How would I go about using that icon to act as the icon on the :poop: posting section rather than the brown square that is there now?

I’ve no real experience with css/html but if anyone could show me a quick example and then I’m quite confident I can use that to then go on to change the rest of the icons.

Thank you.

For those struggling with this change breaking all the Font Awesome 4 icons on their website, I have found “the easy way” to fix it and highly recommend it for the time being. (Disclaimer: I am not an authority here, just someone who uses and loves this software)

  1. Go to this official Font Awesome page titled Get Started with Font Awesome which seems to be the latest 4.x.x-version
  2. Type your email to have them send you what is called a CDN
  3. Copy the short <script src=[...]></script> that they emailed you into your skin’s HTML (such as the </head> tab)
  4. Refresh your page (and maybe your browser cache) and your Font Awesome 4 icons will be restored.

Yes, this will add a few KB to your page, but it will also make your page function immediately. If you are interested in shaving off the extra KB on your site’s initial load time, then you can add “convert to FA5” to your list for when you have the time. Meanwhile your site continues to function while you take the time to do these changes.

In the future I hope Discourse can avoid silently dropping features like this, especially when it is definitely aware of them as “breaking changes”. I used the previously-supported CSS :before method in my skin to insert icons where I wanted them, because there were no handlebars at those locations and this was a simple and easy way to get them exactly where I wanted with no fuss. In retrospect, I would have expected one or two of the following options to have been in place:

  • Show a message on the admin panel or update pages explaining that certain features (:before and <i> icon methods) would soon be dropped, so that we are aware beforehand that all our icons are about to be replaced with empty boxes. (meta-discourse announcements are not otherwise in my radar, and they shouldn’t have to be)
  • Provide a new website option for reverting to Font Awesome 4, with the note that all new discourse installations will use only FA5 and that support for this FA4 compatibility option would eventually be dropped.
  • Provide a set of official instructions for converting :before or <i class="fa fa-icon"></i> usages to the new system. In this case I don’t think this would have been possible, because these changes are not necessarily trivial, especially in the case of :before.
  • Allow us to use an older version of Discourse that will continue to receive security updates but not breaking changes. (Right now the big sad face on the admin screen every 20 days seems to discourage this method of keeping our websites intact)

Fact is, this update has breaking changes in it, and these changes were not advertised to all the site admins using discourse, and these changes do not have any official instructions for making a smooth transition. Shaving off KBs and other optimizations are great, but in my opinion, not unexpectedly breaking websites to get there is even better, so I am confused why the official statements here actively discourage “the easy way” I have given as a temporary solution. I love Discourse and hold a very high opinion of it, but I also want to have to visit meta-discourse as infrequently as possible. :slight_smile:


@troid92 you’ve given problematic advice for these reasons, as previously stated:

If you don’t want to fix things, never upgrade your Discourse instance. You will eventually get hacked and compromised, of course, but that’s your choice. If you want zero effort, I suggest you pay for managed hosting. Otherwise, you may have to do an hour or two of work per month when choosing to host your own Discourse.

Free software is indeed free, but people’s time isn’t.


Respectfully, I am aware of the problem with my advice. In my post I said that this is a temporary solution so that one can take the time to convert to FA5 icons.

It is completely reasonable to expect web admins to perform an hour or two of work per month to maintain a Discourse server through updates, and I was never contesting that. I have been doing that at each update for the past year, and things have been going very smoothly.

Where I was coming from is that upgrading my skin from FA4 will take me more than 1-2 hours, and it arrived as a surprise fire to put out immediately. This is why I found a way to delay that fire by a week, and suggested possible solutions like an in-app heads-up next time. I am sorry if the tone of my first post was colder than I intended – it was meant to be constructive.

@codinghorror Thank you so much for providing free software, and I hope to continue posting feedback and any bugs I find to help it improve and grow.


It’s not a temporary solution, it’s a band-aid to a symptom which ultimately makes it harder to identify and fix the broken icons.

Better to not add the script, identify and fix in all cases. Once a site adds the band-aid there is no impetus to fix it for real.

1 Like

I disagree. You can simply create a copy of your theme, remove the script tag, click preview and see what broke. The rest of your members see a functional site as you work to resolve the issues. This gives them the impression of stability while you are only aware of the underlying issues at hand.

I spent more time than I’d like to admit to fix our instance (SP) which is hosted, it was definitely more than 1-2 hours and some of the fixes were not obvious. In some places you had to set width and heights both on the object and in the svg, along with figuring out coloring, etc. It took time. Sure I got it done, but I also used a “preview” theme to ensure I didn’t make the experience worse for anyone else in the meantime.


As long as it is really a temporary fix, that’s fine. This did not come across to me in your original post, though.


Using icons in your handlebars templates

Is there any way to specify the size of the icon in the handlebars code (eg: size=‘2x’ )? or should we do this in CSS?

You would have to specify the size in CSS. The d-icon helper can take a title parameter, but not a style or size parameter.