How to add additional social media icons

Hi!
I know this guide may cause some minor issues for users. Therefore, based on the above-mentioned guide, I updated the content to make it 100% working.

  1. Go to https://fontawesome.com/ and create an account there.
  2. After creating an account, create your own kit. Your Kits | Font Awesome

image

  1. Then click on the name of your fontawesome package

  1. You will see the entire line that you need to put in your Code InjectionSite header

  1. Go to code generator from tutorial and USE ONLY
    How to add social media icons to your Ghost theme
<style>
    .gh-head-menu .nav-discord a {
        font-size: 0 !important;
    }

    .gh-head-menu .nav-discord a::before {
        font-family: "Font Awesome 6 Brands";
        display: inline-block;
        font-size: 20px;
        font-style: normal;
        font-weight: normal;
        font-variant: normal;
        text-rendering: auto;
        -webkit-font-smoothing: antialiased;
    }

    .gh-head-menu .nav-discord a::before {content: "\f392"}
</style>
  1. That’s all. Enjoy!

IMPORTANT This work only on default themes from ghost. If You have own custom theme, You need to check CSS code for work it correctly.

1 Like

Hi there,

The SM icons were working fine up until now, and suddenly icons disappeared and I was seeing just empty rectangles. Links are working fine though, the problem is in the icons’ codes, I suppose. I can’t figure out how to remedy this, I tried everything. I managed to get the icons to spell the names of the respective SM.

Thank you in advance for your help.

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/brands.min.css" integrity="sha512-+oRH6u1nDGSm3hH8poU85YFIVTdSnS2f+texdPGrURaJh8hzmhMiZrQth6l56P4ZQmxeZzd2DqVEMqQoJ8J89A==" crossorigin="anonymous" referrerpolicy="no-referrer" />

<style>
.gh-foot-menu .nav-x-twitter a,
.gh-foot-menu .nav-linkedin-in a {
  font-size: 0 !important;
}
  
.gh-foot-menu .nav-x-twitter a::before,
.gh-foot-menu .nav-linkedin-in a::before {
  font-family: "Font Awesome 6 Brands";
  display: inline-block;
  font-size: 20px;
  font-style: normal;
  font-weight: normal;
  font-variant: normal;
  text-rendering: auto;
  -webkit-font-smoothing: antialiased;
}
</style>
<style>
.gh-foot-menu .nav-x-twitter a::before {
  content: "\e61b";
}
.gh-foot-menu .nav-linkedin-in a::before {
  content: "\f0e1";
}
</style>


Hi,

Thanks for contact.
Please read whole article one more time. This tutorial works 100% fine but You need to change Your cdn link from fontawesome.

Have a good day!
Peter

1 Like

Since the icons already worked once, do you potentially have a live URL we can have a look at?

Yes, sorry for not providing it earlier - https://web3plusai.xyz/.

Thank you, it worked.

1 Like

No problem, have a good day!

Hey folks, I’ve used this post to get font-awesome working and it does well, thank you.

I do have one further question though. In my kit I have a couple of uploaded custom icons (pixelfed and peertube).

I can see how to add these into this method but

  font-family: "Font Awesome 6 Brands";

is not the right font-family and I can’t for the life of me find the right name or even guess it (have tried font-family: "Font Awesome 6 Kit/Uploads/Kit Uploads";) All fail and show the rectangle.

If I write Pro at the end instead i get the incorrect icon because e000 is a caravan in that set and not the peertube icon.

Has anyone figured this out or can anyone point me in the correct direction.

1 Like

To answer my own question you need to use:

        font-family: "Font Awesome Kit";

This then works :)

2 Likes

Has anything changed in regards to this syntax, because it does not work for me today: 2024-12-07

Ghost = v5.104.0
Theme = source v1.4.1
My free fontawesome kit version = v6.7.1

Fontawesome Kit domain configured with wildcard ‘*’ to accept all subdomains; no custom icons.

I’ve updated my previously working code with your instructions here including my own [NEW] fontawesome script snippet, made sure the my style snippets use your format (actually tried both approaches) rather than what’s listed on How to add social media icons to your site.

<script src="https://kit.fontawesome.com/{provided}.js" crossorigin="anonymous"></script>
<style>
    .gh-head-menu .nav-bluesky a,
    .gh-head-menu .nav-linkedin a,
    .gh-head-menu .nav-keybase a,
    .gh-head-menu .nav-rss a {
        font-size: 0 !important;
    }

    .gh-head-menu .nav-bluesky a::before,
    .gh-head-menu .nav-linkedin a::before,
    .gh-head-menu .nav-keybase a::before,
    .gh-head-menu .nav-rss a::before {
        font-family: "Font Awesome 6 Brands";
        display: inline-block;
        font-size: 20px;
        font-style: normal;
        font-weight: normal;
        font-variant: normal;
        text-rendering: auto;
        -webkit-font-smoothing: antialiased;
    }

    .gh-head-menu .nav-bluesky a::before {content: "\e6a3"}
    .gh-head-menu .nav-linkedin a::before {content: "\f08c"}
    .gh-head-menu .nav-keybase a::before {content: "\f4f5"}
    .gh-head-menu .nav-rss a::before {content: "\f143"}

    .gh-footer-menu .nav-bluesky a,
    .gh-footer-menu .nav-linkedin a,
    .gh-footer-menu .nav-keybase a,
    .gh-footer-menu .nav-rss a {
        font-size: 0 !important;
    }

    .gh-footer-menu .nav-bluesky a::before,
    .gh-footer-menu .nav-linkedin a::before,
    .gh-footer-menu .nav-keybase a::before,
    .gh-footer-menu .nav-rss a::before {
        font-family: "Font Awesome 6 Brands";
        display: inline-block;
        font-size: 20px;
        font-style: normal;
        font-weight: normal;
        font-variant: normal;
        text-rendering: auto;
        -webkit-font-smoothing: antialiased;
    }

    .gh-footer-menu .nav-bluesky a::before {content: "\e6a3"}
    .gh-footer-menu .nav-linkedin a::before {content: "\f08c"}
    .gh-footer-menu .nav-keybase a::before {content: "\f4f5"}
    .gh-footer-menu .nav-rss a::before {content: "\f143"}
</style>

I’m done hacking on this for now and will simply rip it out since it’s useless as is. When I learn of the correct syntax, I’ll add it back in :smiley:

Cheers ~

PS: Does the order these are listed in have to match the order of the secondary menu where these are referenced?
PPS: I also tried font-family: "Font Awesome Kit", font-family: "Font Awesome 6 Kit", font-family: "bluelfonts", …

Those selectors don’t match Source’s classes, which is why they don’t work.

.gh-head-menu .nav-bluesky a needs to be .gh-navigation-menu .nav-bluesky a and so on.

For the footer, what you have /should/ be working.

1 Like

Thank you so much, that got me on the right track!

Now it works ~ :smile:

<script src="https://kit.fontawesome.com/{{YOUR_CODE}}.js" crossorigin="anonymous"></script>

<style>
    :where(.nav, .gh-navigation-menu) .nav-bluesky a,
    :where(.nav, .gh-navigation-menu) .nav-linkedin a,
    :where(.nav, .gh-navigation-menu) .nav-keybase a,
    :where(.nav, .gh-navigation-menu) .nav-rss a {
        font-size: 0 !important;
    }

    :where(.nav, .gh-navigation-menu) .nav-bluesky a::before,
    :where(.nav, .gh-navigation-menu) .nav-linkedin a::before,
    :where(.nav, .gh-navigation-menu) .nav-keybase a::before,
    :where(.nav, .gh-navigation-menu) .nav-rss a::before {
        font-family: "Font Awesome Free";
        display: inline-block;
        font-size: 20px;
        font-style: normal;
        font-weight: normal;
        font-variant: normal;
        text-rendering: auto;
        -webkit-font-smoothing: antialiased;
    }

    :where(.nav, .gh-navigation-menu) .nav-bluesky a::before {content: "\e6a3"}
    :where(.nav, .gh-navigation-menu) .nav-linkedin a::before {content: "\f08c"}
    :where(.nav, .gh-navigation-menu) .nav-keybase a::before {content: "\f4f5"}
    :where(.nav, .gh-navigation-menu) .nav-rss a::before {content: "\f143"}
  
    :where(.nav, .gh-footer-menu) .nav-bluesky a::before,
    :where(.nav, .gh-footer-menu) .nav-linkedin a::before,
    :where(.nav, .gh-footer-menu) .nav-keybase a::before,
    :where(.nav, .gh-footer-menu) .nav-rss a::before {
        font-family: "FontAwesome";
        display: inline-block;
        font-size: 20px;
        font-style: normal;
        font-weight: normal;
        font-variant: normal;
        text-rendering: auto;
        -webkit-font-smoothing: antialiased;
    }

    :where(.nav, .gh-footer-menu) .nav-bluesky a::before {content: "\e6a3"}
    :where(.nav, .gh-footer-menu) .nav-linkedin a::before {content: "\f08c"}
    :where(.nav, .gh-footer-menu) .nav-keybase a::before {content: "\f4f5"}
    :where(.nav, .gh-footer-menu) .nav-rss a::before {content: "\f143"}
</style>
1 Like

I’m trying to use this tutorial to add social media icons to my secondary navigation bar. While everything worked great, when I tried to add additional icons that are not part of the “Brands” font family, I’m getting a square with an X through it. I would like to add an envelope icon in the primary navigation for contact, and an RSS icon in the secondary navigation for an RSS feed. Right now they are showing a square with an X. Specifically,

  1. How to I get the envelope and rss icon to show properly in the navigation bars?
  2. How can I fix the vertical alignment of my secondary navigation? The text-based links seem higher than the logo and social media links.
  3. How would I center the content on the secondary navigation bar? It seems left-aligned except for the “Powered by Ghost”.

My site is here: https://www.gregforcey.com/

Here is my current icon code injection following the tutorial at the beginning of the thread:

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/brands.min.css" integrity="sha512-DJLNx+VLY4aEiEQFjiawXaiceujj5GA7lIY8CHCIGQCBPfsEG0nGz1edb4Jvw1LR7q031zS5PpPqFuPA8ihlRA==" crossorigin="anonymous" referrerpolicy="no-referrer" />

<style>
    :where(.nav, .gh-head-menu) .nav-bluesky a,
    :where(.nav, .gh-head-menu) .nav-linkedin a,
    :where(.nav, .gh-head-menu) .nav-github a,
    :where(.nav, .gh-head-menu) .nav-researchgate a,
    :where(.nav, .gh-head-menu) .nav-threads a,
    :where(.nav, .gh-head-menu) .nav-orcid a,
    :where(.nav, .gh-head-menu) .nav-google-scholar a,
    :where(.nav, .gh-head-menu) .nav-contact a,
    :where(.nav, .gh-head-menu) .nav-rss a,
    :where(.nav, .gh-head-menu) .nav-x a {
        font-size: 0 !important;
    }

    :where(.nav, .gh-head-menu) .nav-bluesky a::before,
    :where(.nav, .gh-head-menu) .nav-linkedin a::before,
    :where(.nav, .gh-head-menu) .nav-github a::before,
    :where(.nav, .gh-head-menu) .nav-researchgate a::before,
    :where(.nav, .gh-head-menu) .nav-threads a::before,
    :where(.nav, .gh-head-menu) .nav-orcid a::before,
    :where(.nav, .gh-head-menu) .nav-google-scholar a::before,
    :where(.nav, .gh-head-menu) .nav-contact a::before,
    :where(.nav, .gh-head-menu) .nav-rss a::before,
    :where(.nav, .gh-head-menu) .nav-x a::before {
        font-family: "Font Awesome 6 Brands";
        display: inline-block;
        font-size: 20px;
        font-style: normal;
        font-weight: normal;
        font-variant: normal;
        text-rendering: auto;
        -webkit-font-smoothing: antialiased;
    }

    :where(.nav, .gh-head-menu) .nav-bluesky a::before {content: "\e671"}
    :where(.nav, .gh-head-menu) .nav-linkedin a::before {content: "\f08c"}
    :where(.nav, .gh-head-menu) .nav-github a::before {content: "\f09b"}
    :where(.nav, .gh-head-menu) .nav-researchgate a::before {content: "\f4f8"}
    :where(.nav, .gh-head-menu) .nav-threads a::before {content: "\e618"}
    :where(.nav, .gh-head-menu) .nav-orcid a::before {content: "\f8d2"}
    :where(.nav, .gh-head-menu) .nav-google-scholar a::before {content: "\e63b"}
    :where(.nav, .gh-head-menu) .nav-contact a::before {content: "\f0e0"}
    :where(.nav, .gh-head-menu) .nav-rss a::before {content: "\f09e"}
    :where(.nav, .gh-head-menu) .nav-x a::before {content: "\e61b"}
</style>

Thank you!

Hey, I’m a complete novice with this stuff.

I’m trying to get the social media icons to work in the footer and I’ve tried adapting what I learned in here but I’m just having no luck.

Help please!

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/brands.min.css" integrity="sha512-DJLNx+VLY4aEiEQFjiawXaiceujj5GA7lIY8CHCIGQCBPfsEG0nGz1edb4Jvw1LR7q031zS5PpPqFuPA8ihlRA==" crossorigin="anonymous" referrerpolicy="no-referrer" />

<style>
    :where(.nav, .gh-foot-menu) .nav-Bluesky a,
    :where(.nav, .gh-foot-menu) .nav-Instagram a,
    :where(.nav, .gh-foot-menu) .nav-Threads a,
    :where(.nav, .gh-foot-menu) .nav-X a,
    :where(.nav, .gh-foot-menu) .nav-YouTube a {
        font-size: 0 !important;
    }

    :where(.nav, .gh-foot-menu) .nav-Bluesky a::before,
    :where(.nav, .gh-foot-menu) .nav-Instagram a::before,
    :where(.nav, .gh-foot-menu) .nav-Threads a::before,
    :where(.nav, .gh-foot-menu) .nav-X a::before,
    :where(.nav, .gh-foot-menu) .nav-YouTube a::before, {
        font-family: "Font Awesome Kit";
        display: inline-block;
        font-size: 20px;
        font-style: normal;
        font-weight: normal;
        font-variant: normal;
        text-rendering: auto;
        -webkit-font-smoothing: antialiased;
    }

    :where(.nav, .gh-foot-menu) .nav-Bluesky a::before {content: "\e671"}
    :where(.nav, .gh-foot-menu) .nav-Instagram a::before {content: "\f16d"}
    :where(.nav, .gh-foot-menu) .nav-Threads a::before {content: "\e618"}
    :where(.nav, .gh-foot-menu) .nav-X a::before {content: "\e61b"}
    :where(.nav, .gh-foot-menu) .nav-Youtube a::before {content: "\f167"}
</style>

This is me https://www.gamefriend.co.uk

Are there error messages in the browser console?

What would that look like? Apologies, I’m really fresh to all of this. Is this what you mean?

That’s your code injection. Go to your main site (not /ghost) and press f12 to open the browser’s dev tools. Then click the console tab.

(If that doesn’t work for your browser, google how to access the browser’s console.)

Thanks! I’ve got it open and it looks like the console is empty?

Now that I’m at my desk… (drinking my :hot_beverage: before I get to coding).
I agree, I don’t see an error either. So the problem is the css selectors.

Here’s that part of your site (same F12 to open dev tools, then the ‘elements’ part)

Your selectors are wrong.
:where(.nav, .gh-foot-menu) .nav-Bluesky a means we’re looking for either a class named nav, or a class named gh-foot-menu, and then within it, we’re looking for a class named nav-Bluesky, and then within that, we’re looking for an a.

Which you almost have, except that Ghost lowercases your nav items (they’re actually the slugs). So I think you need nav-bluesky everywhere you currently have nav-Bluesky.

There’s a comma after your last a::before, that’s making the whole section invalid. Remove that.

You may also need to change your font-family to “Font Awesome 6 Brands”, based on the stylesheet you’re loading.

Finally, this theme is already using the ::before selector, to put those dots between elements in the menu. So, you are either going to need to add !important to everything (and possible add more style overrides, like for font size), or you might try switching all the ::before to after.

For anyone who comes after, the tutorial and code generator here is pretty good: How to add social media icons to your Ghost theme
(It would have avoided the capitalization problem and the comma problem at least.)
However, it doesn’t work 100% of the time on every theme out there, because your theme designer might have used different selectors or incompatible styles.

1 Like

Alright! I applied those changes. It looks like this now - and it works!

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/brands.min.css" integrity="sha512-DJLNx+VLY4aEiEQFjiawXaiceujj5GA7lIY8CHCIGQCBPfsEG0nGz1edb4Jvw1LR7q031zS5PpPqFuPA8ihlRA==" crossorigin="anonymous" referrerpolicy="no-referrer" />

<style>
    :where(.nav, .gh-foot-menu) .nav-bluesky a,
    :where(.nav, .gh-foot-menu) .nav-instagram a,
    :where(.nav, .gh-foot-menu) .nav-threads a,
    :where(.nav, .gh-foot-menu) .nav-youtube a {
        font-size: 0 !important;
    }

    :where(.nav, .gh-foot-menu) .nav-bluesky a::after,
    :where(.nav, .gh-foot-menu) .nav-instagram a::after,
    :where(.nav, .gh-foot-menu) .nav-threads a::after,
    :where(.nav, .gh-foot-menu) .nav-youtube a::after {
        font-family: "Font Awesome 6 Brands";
        display: inline-block;
        font-size: 20px;
        font-style: normal;
        font-weight: normal;
        font-variant: normal;
        text-rendering: auto;
        -webkit-font-smoothing: antialiased;
    }

    :where(.nav, .gh-foot-menu) .nav-bluesky a::after {content: "\e671"}
    :where(.nav, .gh-foot-menu) .nav-instagram a::after {content: "\f16d"}
    :where(.nav, .gh-foot-menu) .nav-threads a::after {content: "\e618"}
    :where(.nav, .gh-foot-menu) .nav-youtube a::after {content: "\f167"}
</style>

Thank you! I’ve got those icons down there now, so that’s awesome!

I’ve got the icons all sorted now, but would love to add a custom colour, and to bolden the text of the pages in the footer too - what would I need to inject to do that?

Thank you so much Cathy_Sarisky! Enjoy your :hot_beverage:

1 Like