framework
framework copied to clipboard
An option to control the google font links
The extraHead option allows to define an HTML fragment to add to the top of the page’s head. It defaults to the 3 links that allow to use the Source Serif Pro font from Google Fonts. (Prefer the head option, unless your goal is to remove or replace the default fonts.)
Note that its defaults will evolve once we self-host fonts (#423).
Yes, for example here is the approach that vitepress supports: https://vitepress.dev/reference/site-config#example-adding-google-fonts
which I implemented in the companion PR for Plot here https://github.com/observablehq/plot/pull/2139/commits/071e9a19df5a8b2b08588cbaf397aa27595e0819
Yes so maybe we just need an extraHead option that does both the preconnect and the stylesheet, and then we can remove both hardcoded references to Google Fonts?
OK, I'll work on this, should be quick (but I don't think it's blocking for #1588).
I've implemented extraHead but now I'm thinking that the only thing we need is a flag to cancel the three links, since we can implement the new fonts in the head option?
Can you please re-merge main and resolve the conflicts? I can’t review this because it now includes a copy of all the other changes.
I don't like the extra complexity, and suggest #1592 instead.
I believe this is temporary, since #423 wants to detect and preload the default google font (if it's used).
(We'll probably have to move font definitions from global.css to font.css to make it possible to create a custom style.css that does not include the now unused import.)
My vote is to keep this private (and simple), #1595.