fix(publish-dialog): show Space URL instead of /published/<doc> path
Browse filesThe success state used to display `Live at /published/default` and link
to `/published/default/index.html`, surfacing an implementation detail
of the publisher pipeline (used internally for PDF rendering and
og:image) rather than the canonical URL readers actually visit.
When a published article exists, the backend serves it at the Space
root (`app.get("*")` in `create-app.ts`). Switch the modal to surface
`window.location.origin` instead, both for the displayed URL and the
"View published article" link target.
Made-with: Cursor
frontend/src/components/PublishDialog.tsx
CHANGED
|
@@ -145,8 +145,14 @@ export const PublishDialog = forwardRef<HTMLDialogElement, Props>(function Publi
|
|
| 145 |
}
|
| 146 |
}, [stageEvent, state]);
|
| 147 |
|
| 148 |
-
|
| 149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
|
| 151 |
return (
|
| 152 |
<dialog
|
|
|
|
| 145 |
}
|
| 146 |
}, [stageEvent, state]);
|
| 147 |
|
| 148 |
+
// Readers land on the Space root: when a published article exists,
|
| 149 |
+
// `backend/src/create-app.ts` (`app.get("*")`) serves it at `/`. The
|
| 150 |
+
// `/published/<docName>/...` path is an implementation detail used by
|
| 151 |
+
// the publisher pipeline (PDF generation, og:image, ...), not the
|
| 152 |
+
// canonical reader URL. So we surface the Space URL itself.
|
| 153 |
+
const origin = typeof window !== "undefined" ? window.location.origin : "";
|
| 154 |
+
const publishedUrl = origin ? `${origin}/` : "/";
|
| 155 |
+
const displayUrl = origin || "/";
|
| 156 |
|
| 157 |
return (
|
| 158 |
<dialog
|