fix(ssg): fix og:url leaking Docker internal URL and make og:image absolute#19
Merged
Conversation
…enerated HTML During SSG prerender, WEBSTUDIO_PRERENDER_ORIGIN=http://app:3000 leaks into og:url in the generated HTML. og:image is also emitted as a relative path, which social scrapers can't resolve. Post-process all generated HTML files after Vite build: - replace BUILDER_INTERNAL_URL occurrences with the public HTTPS domain - make og:image / twitter:image relative paths absolute Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The publisher only checked vike's version to decide whether to reinstall. When the webstudio CLI is upgraded, the generated package.json declares new @webstudio-is/* versions but the cached node_modules still has the old ones, causing "Missing specifier" errors (e.g. ./components in sdk-components-react). Add a version check on sdk-components-react: if installed != declared, wipe node_modules and reinstall. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The build runs once using publishDomain as canonical origin, then the same dist/ is copied for each custom domain. Without rewriting, og:url in all copies points to the wstdwork slug domain instead of the custom domain. Refactor fixHtmlMeta into transformHtmlFiles(dir, transform) and apply a second pass on each custom domain copy to replace publishDomain with the custom domain. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.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.
Problem
In SSG mode, the publisher runs Vite prerender with
WEBSTUDIO_PRERENDER_ORIGIN=http://app:3000(the internal Docker URL). This origin leaks into the generated HTML:Two issues:
og:urlcontains the Docker-internal hostname instead of the public domainog:imageis a relative path — social scrapers (WhatsApp, Slack, LinkedIn, Twitter) can't resolve it, especially whenog:urlis also brokenFix
After the Vite build and before copying to
/var/publish/, post-process all generated HTML files:BUILDER_INTERNAL_URLwithhttps://<publishDomain>og:imageandtwitter:imagerelative paths absoluteTest plan
og:urlshould behttps://<domain>/pageog:imageshould be an absolute URL (https://<domain>/assets/...)🤖 Generated with Claude Code