Local fonts installation

Hello,

I try to install a local font for my Blog. I installed Ghost with docker-compose. Where must I place the ttf file?

In content/themes/yourtheme/assets would be a reasonable choice. (You may need to make the assets folder if your theme doesn’t have one.)

Okay thank you. But I have first check my site then posting. :blush: It seems my blog has local fonts. Can’t find no external resource at the browser console are with any other tool.

I am new the Ghost.

I have an adjacent problem: I own the licence to multiple woff2 font files (for web use) and I can’t figure out where to put them, either.

I tried using the sample Code Injection, but they don’t come up as usable. I tried to modify the css and that didn’t work, either.

I am a total noob, can someone help? (Digest theme, if that matters)

Code Injection can add the CSS needed to use a font, but it cannot upload or store the .woff2 files themselves. Also, a font declared with @font-face will not appear as a new option in Ghost’s font picker—you need to apply it with CSS.

For Digest, the most reliable solution is to include the font files in the theme:

  1. Download and unzip the Digest theme.

  2. Create an assets/fonts folder.

  3. Put your .woff2 files in that folder.

  4. In default.hbs, add the following directly after {{ghost_head}}:

<style>
    @font-face {
        font-family: "My Custom Font";
        src: url('{{asset "fonts/my-font-regular.woff2"}}') format("woff2");
        font-weight: 400;
        font-style: normal;
        font-display: swap;
    }

    @font-face {
        font-family: "My Custom Font";
        src: url('{{asset "fonts/my-font-bold.woff2"}}') format("woff2");
        font-weight: 700;
        font-style: normal;
        font-display: swap;
    }

    :root {
        --font-sans: "My Custom Font", Arial, sans-serif;
        --font-serif: "My Custom Font", Georgia, serif;
    }
</style>

Change the filenames to match your actual files exactly—paths and filenames are case-sensitive. Then zip the theme again and upload the modified version.

If you cannot upload a modified theme, the other option is to host the font files somewhere publicly accessible and use their full HTTPS URLs in the @font-face declarations in Code Injection.

Also check that your font licence allows you to self-host the files on the domain where they will be used.

THANK YOU!! That is so helpful!

Thanks for the reminder about the licenses needed --I bought those ages ago, including web use.

One further question --this worked, but now the quote style rendering in plain text instead of italics… Help?

Glad it works! The snippet I posted only covered regular and bold, so there’s no italic version of your font loaded yet. If your license came with an italic file, put it in assets/fonts too and add a third block inside the same style tag in default.hbs:

@font-face {
    font-family: "My Custom Font";
    src: url('{{asset "fonts/my-font-italic.woff2"}}') format("woff2");
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

Swap in your real filename and keep the font-family name the same as the other two. Re-zip, upload, and hard refresh.

If there’s no italic file in your set, which files do you have?

I do have ALL the files, condensed, italic, bold, bold italic, the whole bunch. But the theme I use only has bold italic, bold and italic.

Thanks so much for this, it’s amazing!