Skip to content

Serve Both Sites' Fonts From the Sites Themselves - #531

Merged
ptr727 merged 4 commits into
developfrom
feature/self-host-fonts
Oct 25, 2026
Merged

ptr727 merged 4 commits into
developfrom
feature/self-host-fonts

Conversation

@ptr727

@ptr727 ptr727 commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Summary

Both sites now serve their web fonts themselves rather than from Google Fonts, which is step 1 of #529. Each page view no longer sends the reader's address and referrer to Google, and neither policy names another host for styles or fonts.

  • Blog. Lexend 400 is served from static/fonts/lexend/. assets/css/extended/custom.css declares it, and layouts/_partials/extend_head.html now preloads the Latin file instead of linking the Google stylesheet.
  • Family site. Cormorant Garamond and EB Garamond are served from sites/viljoen.family/fonts/. site.css declares them, and both pages drop the Google preconnect and stylesheet links.
  • Files. Each upright file is a variable font covering its family's weights in use, and each italic file is the one weight Google Fonts served. These are the Latin and Latin Extended files Google Fonts serves, byte for byte, and the @font-face rules carry Google's unicode ranges, so a page fetches only the subsets its text uses. Each family's OFL.txt is beside its files, as the SIL Open Font License requires. The weights and styles declared are the ones the Google URLs requested, so rendering is unchanged, the family site's italic 600 still synthesized from italic 500 included.
  • Policies. The blog's goes to style-src 'self' 'unsafe-inline'; font-src 'self'. The family policy does the same and drops the two Google connect-src hosts. deploy/Caddyfile and checks/security-headers.txt change together.
  • Caching. The font files join the one-hour class on both sites, everything under /fonts/ on the blog and *.woff2 on the family site. deploy/README.md "Cache lifetimes" says so.
  • Repository handling. *.woff2 is binary in .gitattributes and excluded from editorconfig-checker. The license texts are excluded from the prose gate and from cspell, since they are carried verbatim.

The comments label covers three edited comments: the custom.css header, the Caddyfile's media-class comment, and the new prose-gate exclusion entry. Each would otherwise describe the old setup or leave the exclusion unexplained.

Part of #529. Its step 2, the build gate that fails on any off-site subresource, is a separate pull request.

Verification

Run on server-2 in a worktree holding this branch:

  • deploy/make-release.sh against the local staging mirror. The URL contract passes, all 1157 local asset references resolve, the orphan count holds at 99, and the CSP script gate passes.
  • checks/check-live-urls.sh: PASS - 1296 URLs honored, with every response carrying the new policies exactly.
  • checks/check-csp-browser.py against the blog: PASS - 328 pages loaded with no violation the allow list lacks.
  • The same check with --urls naming the family pages /en/ and /af/ against the family mirror: neither reported a violation. Its only failures were for /search/, which the check always adds and the family site does not have.
  • A Playwright probe in the same pinned image loaded the blog home page, a post, and both family pages. Every face loaded from the site itself, with zero requests to another origin. Every woff2 answered 200, font/woff2, and public, max-age=3600, and pages kept no-cache. The first run showed the blog's font at no-cache, because Caddy's path matcher does not expand a wildcard mid-path, so /fonts/*.woff2 matched nothing. 4f3a9c7 widened it to /fonts/*.
  • The hub prose gate, with this repository's excludes, reports only the three edited comments the label covers.
  • The local strict review raised one finding over two rounds: the family README called the italic files variable. 0271eb7 fixes it, and the second round found nothing.

🤖 Generated with Claude Code

ptr727 and others added 4 commits October 25, 2026 14:08
Lexend on the blog, and Cormorant Garamond and EB Garamond on the family
site, now load from each site's own fonts/ tree instead of Google Fonts.
Each family ships its Latin and Latin Extended woff2 subsets with its
OFL.txt, declared with Google Fonts' unicode ranges. Both policies drop
the Google hosts, and the font files join the one-hour cache class.

Part of #529.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Caddy's path matcher does not expand a wildcard in the middle of a path, so /fonts/*.woff2 matched nothing and the fonts answered no-cache.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The italic files are static instances, so the soil labels' italic 600 is synthesized, as it was under Google Fonts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ptr727 ptr727 added the comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses label Oct 25, 2026
Copilot AI lite review requested due to automatic review settings October 25, 2026 21:28
@ptr727

ptr727 commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 0271eb726133f9001355fbb1460d4b8895eb1550, the content this pull request carries at that commit against develop, and it recorded 0 findings.

@coderabbitai

coderabbitai Bot commented Oct 25, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 773cd954-d65c-40d7-9305-b1f07be3a182
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (develop@bb8536d). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop     #531   +/-   ##
==========================================
  Coverage           ?   52.39%           
==========================================
  Files              ?       12           
  Lines              ?     3336           
  Branches           ?        0           
==========================================
  Hits               ?     1748           
  Misses             ?     1588           
  Partials           ?        0           
Flag Coverage Δ
python-3.13 52.39% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The cross-site font, CSP, caching, and deployment changes warrant final human review.

No open issues 🎉

What changed in this PR

This pull request self-hosts the web fonts for the blog and family site, removing Google Fonts requests while updating CSP policies, caching, licensing, and repository tooling.

Changes:

  • Adds local Lexend, Cormorant Garamond, and EB Garamond font assets with OFL licenses.
  • Replaces Google Fonts links with local font declarations and a Lexend preload.
  • Updates security headers, Caddy caching, documentation, and binary/license exclusions.
File Description
themes/​README.md Documents the local font preload customization.
static/​fonts/​lexend/​OFL.txt Adds the Lexend license.
sites/​viljoen.family/​site.css Declares local Cormorant Garamond and EB Garamond faces.
sites/​viljoen.family/​README.md Documents locally served family-site fonts and licensing.
sites/​viljoen.family/​index.html Removes Google Fonts resources from the English page.
sites/​viljoen.family/​fonts/​eb-garamond/​OFL.txt Adds the EB Garamond license.
sites/​viljoen.family/​fonts/​cormorant-garamond/​OFL.txt Adds the Cormorant Garamond license.
sites/​viljoen.family/​af/​index.html Removes Google Fonts resources from the Afrikaans page.
layouts/​_partials/​extend_head.html Preloads the blog’s local Lexend font.
deploy/​README.md Documents font caching and local-font CSP behavior.
deploy/​Caddyfile Updates CSP headers and font cache handling.
cspell.json Excludes carried font licenses from spelling checks.
checks/​security-headers.txt Synchronizes expected security headers with the deployment configuration.
assets/​css/​extended/​custom.css Declares the local Lexend font subsets.
.github/​prose-gate-excludes Excludes verbatim font licenses from prose checks.
.gitattributes Marks WOFF2 assets as binary.
.editorconfig-checker.json Excludes WOFF2 assets from formatting checks.

Review effort: Lite

@ptr727

ptr727 commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

Answering the review headline on 0271eb7, "needs a closer look" with no counted finding. The headline names areas rather than a defect, and each was exercised on the local staging mirror before this pull request opened, as the Verification section records:

  • Fonts. A Playwright probe in the pinned browser image loaded every face from the site itself on the blog and both family pages, with no request to another origin.
  • CSP. The browser check loaded 328 blog pages with no violation, and the family pages reported none. The live check confirmed the new policies byte for byte on every response.
  • Caching. Every woff2 answered public, max-age=3600, and pages kept no-cache. The first run caught a Caddy matcher that matched nothing, fixed in 4f3a9c7.
  • Deployment. make-release.sh built and installed the release, and the URL contract held.

Coverage. The review's file table names 17 of the 27 changed files. The 10 it leaves out are the woff2 font files, which are binary and unchanged from what Google Fonts serves. Every text file is in the table.

The maintainer's merge of the promotion stays the human review the headline asks for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants