> As a bonus question: are there any better ways to share (tech) solutions like these between the various sites?
In this case you could essentially make a pull request of your changes to alavetelitheme [1] so that new installs get self-hosted fonts. Wouldn't object to this at all; it's just not been a priority for us. Other sites would then have to apply the changes themselves on their own themes, which is a bit of a pain, but much less difficult than figuring it out from scratch. Ideally you'd make it as a single commit, as that way a git cherry-pick / git patch apply has a higher chance of Just Working.
I'll put that on my todolist. Not urgent though, given how often a new alaveteli site pops up :)
As a potentially more immediately impactful PR, would you be
interested in the same PR against WDTK theme?
https://github.com/mysociety/whatdotheyknow-theme seems to be the
repo you're using?
> I also feel like we can't all just spam the list with "hey I fixed X" type messages
Even linking between our issues [4] and your issues / fixes would be really valuable. That way we can see if we can apply your improvements to Alaveteli. It's often not possible due to our current focus, but at some point we'll get to them – for example, we've finally had some funding that's enabled us to tackle a 9 year old issue! – so having a leg up when we do get to them is just as useful.
As a potentially more immediately impactful PR, would you be interested in the same PR against WDTK theme? https://github.com/mysociety/whatdotheyknow-theme seems to be the repo you're using?
We’ll want to make sure that our servers are set to serve the fonts with long cache policies, eg:Cache-Control: public, immutable, max-age=31536000Since the font files are unlikely to ever change, we could consider very long, or even infinite, cache times.We’ll also want to pre-load the font files, alongside the CSS, to speed up rendering, eg:<link rel="preload" href="/whatever.woff2" as="font" type="font/woff2" />
Even linking between our issues [4] and your issues…
Noted, I've tried to do that wherever I found a relevant issue.
Thanks for the offer. I think we’re happy with Google Fonts at the moment because we don’t believe there’s a privacy implication for us, and self-hosting would lose the CDN performance benefits, which may be material at WDTK’s scale. I’ve also considered removing custom fonts entirely for WDTK.
Will certainly circle back to this if and when we decide to review this position.
Here are some further notes from when we investigated this:
[...]
I’m definitely not up to date on webfonts, so not sure if your code already does this.
Not yet, but it's on my todolist. I've setup fonts so that they are processed with other static assets, so they get a fontname-digest.woff2 filename. That way we can add infinite cache times on them without second thoughts. I just need to tweak the webserver config. Hopefully this should help with the scale issue, although we don't really have this yet!
I'll link all those changes to the tickets mentioned before, in case it can be of use to anyone else.