Writing this down, so that I will not struggle the next time1, I have to do this.
- I use Valkyrie for everything on the blog in various weights, except for code and preformatted stuff, which uses Source Code Pro Medium. Both are WOFF2 fonts.
- Anything in Hugo’s
assets/css/extended
folder will be picked up by Hugo and bundled into a single CSS file. - The fonts are in subdirectories in the
static/fonts/font-name
folder. Anything in thestatic
folder shows up at the root of the site.~/mjb/blog/static/images/test.jpg
will become/images/test.jpg
- I’ve created an
embed-font-name.css
file in thecss
folder above, with embed instructions generously provided by Matthew Butterick in his font documentation for Valkyrie. I adapted the same for Source Code Pro as well. Here’s a sample of myembed-source-code-pro.css
|
|
- Finally, I created a
zz-include-css.css
file, which I use to overide the default CSS, so I can use my custom fonts. Since it starts with a zz it comes after the files above, that start with embed, in the final munged and minified CSS file.
These are my instructions to have most text rendered with Valkyrie and code as Source Code Pro Medium2
|
|
- Look! So pretty :)
P.S. Subscribe to my mailing list!
Forward these posts and letters to your friends and get them to subscribe!
P.P.S. Feed my insatiable reading habit.