fix: make PWA manifest and apple-touch-icon paths baseUrl-aware - #386
Merged
Merged
Conversation
The manifest link and apple-touch-icon href in headTags were root-absolute paths, so on GitHub Pages deployments with BASE_URL=/endusers/ they resolved to the origin root and 404'd. Docusaurus injects headTags verbatim without rewriting them with baseUrl. Build the hrefs from the normalized baseUrl (same pattern already used for the structured-data logo URL), and switch static/manifest.json to relative paths (start_url and icon srcs) so the manifest and its icons resolve correctly under any baseUrl. Fixes #302 Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>
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
The PWA manifest link and apple-touch-icon href in
docusaurus.config.jsheadTagswere emitted as root-absolute paths (/manifest.json,/favicons/apple-touch-icon.png). On the GitHub Pages deployment, which setsBASE_URL=/endusers/, these resolve to the origin root and 404, since Docusaurus injectsheadTagsverbatim without rewriting them withbaseUrl.static/manifest.jsonhad the same problem:start_url: "/"and root-absolute iconsrcvalues, so even if the manifest were reached, the installed app would start at and load icons from the wrong path.This PR:
headTagshrefs from the normalizedbaseUrl(same pattern already used for the structured-data logo URL on line 63).static/manifest.jsonto relative paths (start_url: ".", iconsrcvalues without a leading slash) so the manifest resolves correctly against its own URL under any baseUrl.Closes #302
Verification
Built locally with
SITE_URL=https://castrojo.github.io BASE_URL=/endusers/ npm run buildand confirmed in the generatedbuild/index.htmlandbuild/manifest.json:<link rel=manifest href=/endusers/manifest.json><link ... apple-touch-icon ... href=/endusers/favicons/apple-touch-icon.png>build/manifest.jsonhasstart_url: "."and relative iconsrcvalues.Also verified a default (
BASE_URL=/) build still resolves correctly.Checklist
git commit -s)— hive: backend=copilot model=claude-sonnet-5
🐝 Hive Agent:
contributor| SHA:1399531