chore(frontend): point View Live at the configured public site - #127
Merged
Conversation
The "View Live" link on the articles list built its URL from a hardcoded https://www.thetriangle.org, even though VITE_PUBLIC_SITE_URL already existed and was already plumbed through the frontend image as a build arg — the comments view and the editor's permalink preview both read it. Only this link did not, so it could send an editor to a different site than the rest of the CMS pointed at. Use publicSiteUrl() here too, and set the default to dev.thetriangle.org in both places that define it: the runtime fallback in urls.ts and the ARG in the frontend Dockerfile, which is what the published image actually gets since CI passes no build-arg. The CMS is not driving production yet, so an unconfigured build aimed at www would show editors pages that do not reflect what they just saved. The dashboard's "View site" button had the same hardcoded origin and is included — leaving it would have split the two buttons across two sites. No hardcoded origin remains in the frontend; verified in the built bundle. Co-Authored-By: Claude Opus 5 <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.
The View Live link on the articles list built its URL from a hardcoded
https://www.thetriangle.org, even thoughVITE_PUBLIC_SITE_URLalready existed and was already plumbed through the frontend image as a build arg — the comments view and the editor's permalink preview both read it. Only this link didn't, so it could send an editor to a different site than the rest of the CMS pointed at.Changes
View Liveuses the existingpublicSiteUrl()helper.https://dev.thetriangle.orgin both places that define it: the runtime fallback insrc/auth/urls.ts, and theARGinfrontend/Dockerfile— the latter is what the published image actually gets, sincepublish.ymlpasses no--build-arg. Changing only one would leave the other on www.Verification
npm run buildclean; grepped the built bundle —dev.thetriangle.orgpresent,www.thetriangle.orggone. No hardcoded origin remains in the frontend.Note
Vite inlines
import.meta.envat build time, so this is baked into the image rather than read at container start. Retargeting a deployed image means rebuilding with--build-arg VITE_PUBLIC_SITE_URL=…. Addingbuild-argsto the frontend step inpublish.ymlwould give CI per-environment control; not done here.🤖 Generated with Claude Code