Setup custom font - Obsidian Publish

What I’m trying to do

I have a website published using Obsidian Publish. I would like to have a custom Google Font. Currently, I have the custom css in my publish.css file. I am trying to import Google Font Modern Antiqua into the CSS. However, the Google Fonts is for importing CSS into the head of the HTML file. As far as I know my custom theme does not have a HTML file. So, I am not sure how to go about importing the custom font…

Things I have tried

One idea I had was to download the font and host it myself then refer to it in the @font-face declaration… Something like this:

@font-face {
font-family: "CustomFont";
src: url("https://yoursite.com/css/fonts/CustomFont.eot");
src: url("https://yoursite.com/css/fonts/CustomFont.woff") format("woff"),
url("https://yoursite.com/css/fonts/CustomFont.otf") format("opentype"),
url("https://yoursite.com/css/fonts/CustomFont.svg#filename") format("svg");
}

My concern though is that this could take a long time for a user to call my site and fetch the necessary fonts then bring it back to the Obsidian Publish site.

Does anyone know the best way to do this?

I reached out on Obsidian’s Discord server and got my problem solved there.

The following articles were instrumental in figuring out what I need to do:

UPDATE

After quite a bit of coding on my end I was still not successfully deploying the custom font to my Publish website. So, I reached out again on Discord and got a detailed response from Rebbecca aka sigrunixia.

This pull request resolved my difficulties.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.