Publish the style, samples and fonts to GitHub Pages on release - #52
Merged
Conversation
256 prebuilt SDF glyph .pbf ranges (783 KB) from the openmaptiles/fonts project, served from GitHub Pages at /golfTiles/fonts/{fontstack}/{range}.pbf. The style's new top-level glyphs property (PR #49) points here, which finally lets the symbol layers draw text. Also ignore the _site/ staging directory used by the publishing workflow.
Co-authored-by: HuggeK <48095810+HuggeK@users.noreply.github.com>
New publish-pages.yml workflow (release: published + workflow_dispatch) assembles the site at build time: docs/index.html, docs/samples/*.pmtiles, docs/fonts/ and the canonical styles/golfTilesStyle.json with its pmtiles source URL rewritten to the Pages origin (golftiles.org serves no CORS headers, the reason docs/ previously kept a hand-edited copy). Requires the repo Pages source to be switched to 'GitHub Actions' once. Co-authored-by: HuggeK <48095810+HuggeK@users.noreply.github.com>
docs/index.html now matches the golftiles.org demo (pinned maplibre-gl 5.24.0, pitch 70, navigation and terrain controls) and uses relative URLs served by the publishing workflow. docs/styles/golfTilesStyle.json is deleted: the workflow publishes the canonical styles/golfTilesStyle.json instead, so the copy can no longer go stale. Co-authored-by: HuggeK <48095810+HuggeK@users.noreply.github.com>
Co-authored-by: HuggeK <48095810+HuggeK@users.noreply.github.com>
The browser tab title and heading said golfTiles.org, but this page is the GitHub Pages demo; it now uses the project name and states its own https://huggek.github.io/golfTiles/ URL, keeping golftiles.org as the main-domain link. Co-authored-by: HuggeK <48095810+HuggeK@users.noreply.github.com>
Co-authored-by: HuggeK <48095810+HuggeK@users.noreply.github.com>
Brings the v6 (ESM) demo migration from main into this branch. The only conflict was docs/index.html, where this branch had pinned maplibre to 5.24.0 and main has since moved to the v6 ESM import; resolved in favour of main's v6 import, keeping this branch's Pages-relative URLs, terrain and navigation controls, and rebranding. Also point the published style at the glyph ranges this branch commits. docs/fonts/ was being copied into the site but styles/golfTilesStyle.json declares no 'glyphs' key, so nothing ever requested those 256 files and labels fell back to locally rendered glyphs. The rewrite happens in the same jq step that already rewrites the pmtiles source URL, so the canonical style file stays untouched and does not conflict with the style work on 7-write-the-first-version-of-the-style. Verified by assembling the site exactly as the workflow does and loading it in headless Chrome over a Range-capable server: tiles render, no console errors or failed requests, and /fonts/Open Sans Regular/0-255.pbf is fetched with 200 instead of warning about a missing glyph range. Note for a follow-up: docs/index.html adds a TerrainControl bound to source 'terrainSource', which the canonical style on main does not define - that source arrives with the style branch. The control renders but would fail if clicked until that branch lands. Co-authored-by: HuggeK <48095810+HuggeK@users.noreply.github.com>
The previous commit made the committed glyph ranges actually load, which means the site now redistributes work derived from the Open Sans font files. Apache 2.0 section 4(a) asks that recipients get a copy of the licence, and only the repo README mentioned it - nothing was served. Ship a verbatim copy as docs/fonts/LICENSE.txt. publish-pages.yml already copies the whole docs/fonts/ directory, so it lands at /fonts/LICENSE.txt on the site, and the demo page now carries a visible credit linking to it. Confirmed the licence applies rather than assuming it: openmaptiles/fonts builds its Open Sans ranges from the older static TTFs and ships an 'Apache License.txt' beside them. Upstream Open Sans was relicensed to SIL OFL 1.1 in March 2021 when it became a variable font, so anyone regenerating these ranges from current upstream has to switch the licence. That caveat is recorded in docs/fonts/README.md. Verified by rebuilding the site the way the workflow does: /fonts/LICENSE.txt serves 200, the glyph range still loads, and the page renders clean. Co-authored-by: HuggeK <48095810+HuggeK@users.noreply.github.com>
Two separate things, since the brief conflated them: switching fonts does not reduce the file count, and pruning does not require switching fonts. Font: regenerated from the current upstream Open Sans, the variable ofl/opensans/OpenSans[wdth,wght].ttf in google/fonts, which has been SIL OFL 1.1 since the March 2021 release. The previous ranges came from openmaptiles/fonts, which still builds the pre-2021 static TTFs under Apache 2.0. docs/fonts/LICENSE.txt (Apache) is replaced by OFL.txt, and the page credit now names the OFL and the Open Sans Project Authors. Being variable buys nothing at runtime: MapLibre consumes pre-baked SDF ranges and its style spec has no font axes - text-font is just a list of names joined into a fontstack. FreeType bakes the default instance (wght 400, wdth 100 = Regular), so the axes are flattened at build time. font-maker emits all 256 ranges either way. File count: the clutter was never the font, it was that 240 of the 256 ranges are ~32-byte stubs for scripts Open Sans does not cover. Only the 16 ranges that actually contain glyphs are committed: 256 files/787K becomes 16 files/466K. A missing range 404s rather than returning an empty file, and MapLibre handles both by warning once and rendering that codepoint locally, so nothing renders differently. Generated with MapLibre's own font-maker WASM (the engine behind maplibre.org/font-maker) driven headlessly, so no new tooling was installed. The stack name comes out as 'Open Sans Regular', matching text-font in both the main and style-branch versions of the style. Verified by assembling the site as publish-pages.yml does and loading it: /fonts/Open Sans Regular/0-255.pbf serves 200 and the Emmaboda Golfklubb label renders, with no errors or failed requests. Co-authored-by: HuggeK <48095810+HuggeK@users.noreply.github.com>
HuggeK
marked this pull request as ready for review
August 16, 2026 19:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR is what publishes the site at all. The repo's Pages source is set to GitHub Actions (
build_type: workflow), but the workflow that does the deploying lives here and has never been merged — so nothing has deployed since 5 July 2026. https://huggek.github.io/golfTiles/ is still serving that day's build, which is why the MapLibre v6 fix in #53 had no visible effect after merging.It replaces the hand-synced copies in
docs/that kept going stale:publish-pages.ymlworkflow — runs on every push tomain, on every published release, and manually via workflow_dispatch. It assembles the site from canonical sources at build time:docs/index.html, the canonicalstyles/golfTilesStyle.json,docs/samples/*.pmtilesanddocs/fonts/, then deploys withactions/deploy-pages.Open Sans RegularSDF ranges intodocs/fonts/, served athttps://huggek.github.io/golfTiles/fonts/{fontstack}/{range}.pbf. GitHub Pages sendsAccess-Control-Allow-Origin: *, so the same URL keeps working once golftiles.org serves the style.docs/styles/golfTilesStyle.json— the workflow publishes the canonical style instead, rewriting its pmtiles source URL and itsglyphsURL to the Pages origin withjq.docs/index.html— relative URLs, MapLibre v6, and the same pitch/navigation/terrain controls as the golftiles.org demo.Updated since this PR was first opened
mainin, including the MapLibre v6 (ESM) migration from Migrate the demo pages to MapLibre GL JS v6 (ESM) #53. The one conflict wasdocs/index.html, where this branch had independently pinnedmaplibre-gl@5.24.0— the same diagnosis Migrate the demo pages to MapLibre GL JS v6 (ESM) #53 reached, one major earlier. Resolved to v6'simport * as maplibregl, keeping this branch's Pages-relative URLs, controls and rebranding.glyphsas well as the pmtiles URL. Previouslydocs/fonts/was copied into the site but the canonical style onmaindeclares noglyphs, so nothing ever requested those files and labels silently fell back to locally rendered glyphs. This makes the PR self-sufficient rather than depending on First version of the style: terrain, water, roads and per-course hole colors (#7) #49 landing first.Font: what changed and why
The ranges previously came from openmaptiles/fonts, which still builds the pre-2021 static Open Sans TTFs under Apache 2.0. They are now generated from current upstream — the variable
ofl/opensans/OpenSans[wdth,wght].ttfingoogle/fonts— which has been SIL OFL 1.1 since the March 2021 release.docs/fonts/LICENSE.txt(Apache) is replaced byOFL.txt, published at/fonts/OFL.txt, and the demo page carries a visible credit.Being a variable font buys nothing at runtime: MapLibre consumes pre-baked SDF ranges and the style spec has no font axes, so FreeType bakes the default instance (
wght400,wdth100 = Regular) at build time. It is simply the current, correctly-licensed upstream.256 files → 16. The clutter was never the font: 240 of the 256 ranges are ~32-byte empty stubs for scripts Open Sans does not cover. Only the 16 blocks that contain glyphs are committed. Total glyph data is about the same (~392 KB → ~429 KB — slightly up, since the new font covers two more blocks); the win is file count, not size.
A missing range 404s rather than returning an empty file. MapLibre handles both identically — one warning, then it renders that codepoint locally — and since the omitted blocks have no glyphs anyway, nothing renders differently.
Generated with MapLibre's own font-maker WASM, the engine behind https://maplibre.org/font-maker, so the output is the same as the official tool's.
docs/fonts/README.mddocuments how to regenerate.Why the style's pmtiles and glyphs URLs are rewritten at publish time
The canonical style points its source at
pmtiles://https://golftiles.org/samples/…, but golftiles.org serves no CORS headers (the reason commit 3ff8bf0 originally forked a hand-edited copy intodocs/). The workflow'sjqstep rewrites.sources.golfTiles_source.urlto the Pages origin so the demo fetches tiles same-origin, and sets.glyphsto the ranges copied alongside.Both rewrites leave
styles/golfTilesStyle.jsonitself untouched, so this does not conflict with the style work on #49. Theglyphsvalue it produces is byte-identical to the one #49 adds to the canonical style, so the two agree once #49 lands.jqalso doubles as a JSON-validity gate for the style in CI.Runbook
Flip the Pages source to GitHub Actions— already done; that is why the site is currently frozen.maintriggerspublish-pages.yml, which deploys. Every future push tomainand every published release republishes.#49 is no longer a prerequisite for labels — the
glyphsrewrite above covers that. It is still needed for the terrain control (see below).Known limitation until #49 lands
docs/index.htmladds aTerrainControlbound to sourceterrainSource, which the canonical style onmaindoes not define — that source arrives with #49. The button renders but would fail if clicked. Labels, tiles and everything else are unaffected.Verification
Each page was assembled exactly as the workflow does (
cp+ thejqrewrites) and loaded in headless Chrome over the DevTools Protocol, served through a Range-capable server since pmtiles requires byte serving:maplibre-gl.mjs,maplibre-gl-shared.mjsandmaplibre-gl-worker.mjsall load; the worker comes from the CDN cross-origin via MapLibre's blob module shim./fonts/Open Sans Regular/0-255.pbfreturns 200 and the Emmaboda Golfklubb label renders — previously this range was never requested at all./fonts/OFL.txtreturns 200.jqfilter from the workflow was run through jq 1.8.2 against the canonical style.Pre-existing issue seen while testing, not addressed here
layers[tees_borders].paint.line-color: Could not parse color from value 'yellow;red' Falling back to rgba(0,0,0,1)— looks like a raw OSM multi-value tag reaching the style. It renders black today. Left for a separate PR since it belongs to the style work.🤖 Generated with Claude Code