Skip to content

feat: 301 redirect ds*->on* on dataset detail page - #18

Merged
neuromechanist merged 1 commit into
feature/issue-1-epic-nemar-redesignfrom
feature/issue-17-ds-on-redirect
May 18, 2026
Merged

neuromechanist merged 1 commit into
feature/issue-1-epic-nemar-redesignfrom
feature/issue-17-ds-on-redirect

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Closes #17

Summary

OpenNeuro source ids (ds*) now redirect to their NEMAR canonical (on*) when a mirror exists in the catalog. Deep links from OpenNeuro, search engines, and any pre-existing references to the OpenNeuro id land on the canonical NEMAR page instead of 404ing.

Changes

  • src/lib/api.ts: new resolveCanonical(sourceId) around /datasets/resolve/:id. Returns null on non-2xx so a transient backend failure leaves the request on the original id rather than erroring.
  • src/pages/dataset/[id].astro: when the param matches ^ds\d{6}$, call resolveCanonical and 301 to /dataset/<canonical><query> when found.
  • src/lib/api.test.ts: four new tests (mirror found, found=false, non-2xx, url-encoding).

Local verification

/dataset/ds002718          -> 301 /dataset/on002718
/dataset/ds002718?v=1.0.0  -> 301 /dataset/on002718?v=1.0.0
/dataset/ds007222          -> 404  (no mirror, falls through)
/dataset/on002718          -> 200  (unchanged)
/dataset/nm000154          -> 200  (unchanged)
  • bun run test -> 73/73 (4 new)
  • bun run typecheck -> 0 errors
  • bun run build -> clean

Out of scope (separate issues)

  • Discover-page dedup (nemar-cli list endpoint still returns both ds* and on* shadows; tracked separately)
  • Search-engine masking (covered by website#12)
  • Mirror_of column / catalog backfill

OpenNeuro source ids (ds*) now redirect to their NEMAR canonical (on*)
when a mirror exists in the catalog. /dataset/ds002718 lands on
/dataset/on002718 with the query string preserved; ds* without a mirror
fall through to the existing 404 path.

Adds resolveCanonical() helper around /datasets/resolve/:id with null
fallback on non-2xx so a transient backend failure leaves the request
on the original id instead of erroring.

Refs #17
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying nemar-website with  Cloudflare Pages  Cloudflare Pages

Latest commit: 549c26a
Status: ✅  Deploy successful!
Preview URL: https://d467e896.nemar-website.pages.dev
Branch Preview URL: https://feature-issue-17-ds-on-redir.nemar-website.pages.dev

View logs

@neuromechanist
neuromechanist merged commit 03cf9b4 into feature/issue-1-epic-nemar-redesign May 18, 2026
1 check passed
@neuromechanist
neuromechanist deleted the feature/issue-17-ds-on-redirect branch May 18, 2026 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant