How to Change a Ghost Theme Font Using Google Fonts

Ahmad Ajmi Photo
Ahmad Ajmi

In this new tutorial, I will show you how to change a Ghost theme’s font using a Google Fonts font with CSS. The following is an example of using the Encode Sans font to change the body and the logo font. You can use the same way to change the font of any element.

In your Ghost admin, using the Code Injection Site Header section, embed the font code given from Google Fonts and then assign the font to the body with CSS. Depending on how the theme is developed, this will change the overall theme font.

<link href='https://fonts.googleapis.com/css?family=Encode+Sans:300&display=swap' rel='stylesheet'>

<style>
  body {
    font-family: 'Encode Sans', sans-serif;
  }
</style>
Code Inection Site Header section code to Change a Font in Ghost Theme

Change the Font of a Specific Element

If you want to change the font of a specific element, you can use the browser development tools to get the element’s class name. You can use Google Chrome DevTools in the Chrome browser.

Open the DevTools by right-clicking an element on the page and choose Inspect, and the Elements panel will open. Also, you can press Command+Option+C (Mac) or Control+Shift+C (Windows, Linux, Chrome OS)

Google Chrome Dev Tools Inspect
Google Chrome Dev Tools

Then, you can get the element CSS selector class, in our case, the logo class .c-logo__link, and you can assign the new font to it as follows.

<style>
  .c-logo__link {
    font-family: 'Encode Sans', sans-serif;
  }
</style>

If you want to set the font size for an element, you can use the CSS font-size property to do that. For example, to set the font family and font size for the previous example, you can do something like the following.

<style>
  .c-logo__link {
    font-family: 'Encode Sans', sans-serif;
    font-size: 16px;
  }
</style>

Subscribe to Aspire Themes

You will receive Ghost resources, new themes, and updates.


Write more
Save time & money

Ghost CMS themes for a professional-looking website. Newsletter & membership full support.

Choose your theme →
  • Ghost 4 Support
  • Free Support & Updates
  • 100% Money Back Guarantee