This component allows you to set the main site font, and optionally separate fonts for headlines and monospaced text (code blocks). You can also choose a font weight in each case, and increase the font size.
Behind the scenes this sets up a little bit of CSS along with Google’s font <link>. Note that this is relying on Google to serve the font files from https://fonts.googleapis.com/.
Settings
Name
Description
fonts
Add the name of the font(s) you want to use from fonts.google.com. Note that font names are CaSe SeNsiTivE!
You can add additional styles and weights in the following format (comma separated, no spaces): “Roboto:300,300i,500”
body font
The main font used throughout Discourse, must be included in “fonts” setting above
body font weight
Font thickness in the range of 100-900. 400 is normal, 700 is bold
headline font
Optional font for headlines, must be included in “fonts” setting above
headline font weight
Font thickness in the range of 100-900. 400 is normal, 700 is bold
monospaced font
Optional font for code blocks, must be included in “fonts” setting above.
monospaced font weight
Font thickness in the range of 100-900. 400 is normal, 700 is bold
normal font size
Default font size for all users, adjusting this will adjust all font sizes proportionately
smaller font size
Selectable in each user’s interface preferences
larger font size
Selectable in each user’s interface preferences
largest font size
Selectable in each user’s interface preferences
Hosted by us? Theme components are available to use on our Standard, Business, and Enterprise plans.
Should this work with published pages or does it need to be updated for the new feature? It’s showing as the correct font-family, but it’s not displaying the font on published pages. Thanks!
We have a theme selection step that was just added to the site setup wizard a couple days ago, and this changed how fonts were applied in Discourse generally, so I had to make the component-added style more specific.
I just discovered that this component does not work for /pub/ (published) pages. The fonts are not loading on these pages resulting in a default Times New Roman alike font.
The published page tries to load the google font through the theme component:
The font file not being loaded on the published page, it doesn’t fall back to the font-family variable `Arial, sans-serif and uses Times New Roman instead.
There may be room for improvement here as long as the published pages can access the modifications required.
That’s awesome, thank you and your team for developing such a convenient feature ^^. I will recommend it to people I know who are using discourse to build user communities.