Overview
Bonzai and Brick versions 2.0 and above now support the ability to specify Google fonts in Bonzai. This article describes the process through which this can be achieved.
Solution
The currently supported font library is Google Fonts. You will need a font that supports both a 400 and a 700 weight. For our example, we will be using Roboto Slab.
Select your chosen font
- Load the site and use the search to find a font you'd like to use in Bonzai.
- Set the font to the Regular 400 weight, locate the + (select this font) link. Click on it.
Note: Repeat the process after selecting the Bold 700 weight. If you have different primary and secondary fonts, locate your second font and repeat this process. - A box will appear at the bottom of the page indicating you have selected this Font Family. Expand the selected font and you should see a preview like this:
- For a single font:
- For two fonts:
- For a single font:
- Collect and save the following details:
- The link tag that will go into the Master Page
- The CSS rule that we'll add to Brick.
Update the Bonzai Master page
- Go to Settings Cog > Site Settings > Master pages and page layouts.
- Select Bonzai.
- Click on the Arrow next to bonzai.master, and click on Download a Copy.
- Open the Bonzai Master file you downloaded within a text editor.
- Locate the following line:
<link href="https://fonts.googleapis.com/css?family=Lato:400,700" rel="stylesheet">
- Replace it with the following link rel and the Link Tag you collected for your chosen font:
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@400;700&display=swap" rel="stylesheet"> - Save the changes to the file.
- Re-upload and Publish the modified Bonzai Master File, replacing the original copy.
Update your Brick Settings
- Login to Brick.
- Click on the Themes Icon from the left navigation pane.
- Select Edit next to the theme that your master page is pointing to.
- On the right navigation pane, locate the Primary and Secondary Font fields.
- Add the CSS Value that you collected for your chosen font.
- For our example: 'Roboto Slab', serif;
- Publish your theme.
Testing
After publishing the changes to your Bonzai theme within brick, refresh the page for your Bonzai Intranet. You should now see your new font appearing.