mirror of
https://github.com/nexu-io/open-design.git
synced 2026-06-01 03:14:35 +07:00
fix(landing-page): drop trailing slash from preview iframe URLs (#2790)
Some checks failed
visual-baseline / Capture visual baselines (push) Waiting to run
actionlint / Lint GitHub Actions workflows (push) Failing after 2s
ci / Detect CI change scopes (push) Successful in 1s
landing-page-ci / Validate landing page (push) Failing after 2s
landing-page-deploy / Deploy landing page (push) Has been skipped
nix-check / build (push) Failing after 2s
ci / Validate Nix flake (push) Has been skipped
ci / Preflight (push) Failing after 2s
ci / Workspace unit tests (push) Failing after 1s
ci / Daemon workspace tests (push) Failing after 1s
ci / Web workspace tests (push) Failing after 1s
ci / Browser tests (push) Failing after 1s
ci / Build workspaces (push) Failing after 1s
ci / Validate workspace (push) Failing after 0s
ci / Runtime trace (push) Has been skipped
Some checks failed
visual-baseline / Capture visual baselines (push) Waiting to run
actionlint / Lint GitHub Actions workflows (push) Failing after 2s
ci / Detect CI change scopes (push) Successful in 1s
landing-page-ci / Validate landing page (push) Failing after 2s
landing-page-deploy / Deploy landing page (push) Has been skipped
nix-check / build (push) Failing after 2s
ci / Validate Nix flake (push) Has been skipped
ci / Preflight (push) Failing after 2s
ci / Workspace unit tests (push) Failing after 1s
ci / Daemon workspace tests (push) Failing after 1s
ci / Web workspace tests (push) Failing after 1s
ci / Browser tests (push) Failing after 1s
ci / Build workspaces (push) Failing after 1s
ci / Validate workspace (push) Failing after 0s
ci / Runtime trace (push) Has been skipped
The detail-page interactive preview iframe pointed at `/skills/<slug>/example.html/` and `/templates/<slug>/preview.html/` with trailing slashes. Cloudflare Pages 308-redirects those URLs to the extension-stripped form, but with the trailing slash present it fails to map back to the published `out/skills/<slug>/example.html` file and SPA-falls-back to the homepage. Result: every preview iframe in production rendered the homepage instead of the skill or live-artifact preview. Verified against the deployed site after the #2679 release: - /skills/deck-guizang-editorial/example.html → 4942 bytes (real preview) - /skills/deck-guizang-editorial/example.html/ → 163377 bytes (homepage SPA fallback) - /skills/deck-guizang-editorial/example → 4942 bytes (real preview) - /skills/deck-guizang-editorial/example/ → 4942 bytes (real preview) Drop the trailing slash from all six iframe `src` and "Open in new tab" `href` attributes in `pages/skills/[slug]/index.astro` and `pages/templates/[slug]/index.astro`, plus the inline comment that documented the URL shape. Co-authored-by: Joey-nexu <joeylee12629@gmail.com>
This commit is contained in:
parent
caf7bc3d59
commit
b8cddc421e
2 changed files with 7 additions and 7 deletions
|
|
@ -257,7 +257,7 @@ const jsonLd = [
|
|||
Click-to-expand interactive preview. The thumb itself is the
|
||||
summary of a `<details>` element — clicking the image opens
|
||||
the live iframe, replacing the thumb with the canonical
|
||||
`<slug>/example.html/` rendered inside a sandboxed frame. A
|
||||
`<slug>/example.html` rendered inside a sandboxed frame. A
|
||||
hover overlay on the thumb hints "Click for live preview ↗"
|
||||
so the affordance is discoverable. The iframe loads lazily,
|
||||
only fetching once the user actually expands.
|
||||
|
|
@ -275,7 +275,7 @@ const jsonLd = [
|
|||
</summary>
|
||||
<div class="detail-preview-frame-wrap">
|
||||
<iframe
|
||||
src={`/skills/${skill.slug}/example.html/`}
|
||||
src={`/skills/${skill.slug}/example.html`}
|
||||
title={`${skill.name} interactive preview`}
|
||||
loading="lazy"
|
||||
sandbox="allow-scripts allow-same-origin"
|
||||
|
|
@ -283,7 +283,7 @@ const jsonLd = [
|
|||
/>
|
||||
<a
|
||||
class="detail-preview-popout"
|
||||
href={`/skills/${skill.slug}/example.html/`}
|
||||
href={`/skills/${skill.slug}/example.html`}
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
aria-label="Open preview in new tab"
|
||||
|
|
|
|||
|
|
@ -258,8 +258,8 @@ const jsonLd = {
|
|||
<iframe
|
||||
src={
|
||||
template.origin === 'live-artifact'
|
||||
? `/templates/${template.slug}/preview.html/`
|
||||
: `/skills/${template.slug}/example.html/`
|
||||
? `/templates/${template.slug}/preview.html`
|
||||
: `/skills/${template.slug}/example.html`
|
||||
}
|
||||
title={`${template.name} interactive preview`}
|
||||
loading="lazy"
|
||||
|
|
@ -270,8 +270,8 @@ const jsonLd = {
|
|||
class="detail-preview-popout"
|
||||
href={
|
||||
template.origin === 'live-artifact'
|
||||
? `/templates/${template.slug}/preview.html/`
|
||||
: `/skills/${template.slug}/example.html/`
|
||||
? `/templates/${template.slug}/preview.html`
|
||||
: `/skills/${template.slug}/example.html`
|
||||
}
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
|
|
|
|||
Loading…
Reference in a new issue