Skip to content

Commit 961e7c0

Browse files
committed
feat(docs): host-scoped objectui.org redirects, checked by check-docs-redirects
Claude-Session: https://claude.ai/code/session_01L9qibyMpJZ67jrDrno4jY1 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 8727094 commit 961e7c0

3 files changed

Lines changed: 335 additions & 21 deletions

File tree

‎apps/docs/lib/site.ts‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { DOCS_SITE_ORIGIN } from '@/redirects.mjs';
2+
13
/**
24
* Canonical identity of the documentation site — the origin it names itself by,
35
* and the shared cover asset it presents itself with.
@@ -11,9 +13,11 @@
1113
* Deliberately NOT read from an environment variable. A preview deployment that
1214
* derived its own origin would emit canonical links and a sitemap pointing at the
1315
* preview host — precisely the duplicate-content signal a canonical link exists to
14-
* suppress. One host, declared once, here.
16+
* suppress. One host, declared once: in `redirects.mjs`, the dependency-free
17+
* module `next.config.mjs` also reads, because the objectui.org redirects there
18+
* answer with this same origin.
1519
*/
16-
export const SITE_ORIGIN = 'https://objectstack.ai';
20+
export const SITE_ORIGIN = DOCS_SITE_ORIGIN;
1721

1822
/**
1923
* Absolute URL for a **site-relative** path.
@@ -25,8 +29,8 @@ export const SITE_ORIGIN = 'https://objectstack.ai';
2529
* than reported.
2630
*
2731
* Next's `metadataBase` wants a `URL` rather than a string — write
28-
* `new URL(SITE_ORIGIN)` there, so this file stays the only place the origin is
29-
* spelled out.
32+
* `new URL(SITE_ORIGIN)` there, so the origin is never spelled out a second
33+
* time.
3034
*/
3135
export function absoluteUrl(path: string): string {
3236
if (!path.startsWith('/')) {

‎apps/docs/redirects.mjs‎

Lines changed: 247 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,255 @@ export const blogRedirects = BLOG_PATH_PREFIXES.flatMap((prefix) => [
212212
...MOVED_POSTS.map((slug) => [`${prefix}/blog/${slug}`, `${PRODUCT_SITE_ORIGIN}/en/blog/${slug}/`]),
213213
]);
214214

215-
/** Next.js redirects() entries derived from the two tables above. */
215+
/**
216+
* This site's own origin, declared here for the same reason as
217+
* `PRODUCT_SITE_ORIGIN`: `lib/site.ts` re-exports it as `SITE_ORIGIN` for the
218+
* sitemap, `robots.txt` and the canonical links, and the cross-host redirects
219+
* below name it, so the two can never name two hosts.
220+
*/
221+
export const DOCS_SITE_ORIGIN = 'https://objectstack.ai';
222+
223+
/**
224+
* The hosts the retired ObjectUI docs site answered on. `has` values are
225+
* anchored regular expressions in Next (`^…$`), matched against the request's
226+
* hostname with any port removed.
227+
*/
228+
export const OBJECTUI_HOST_PATTERN = '(?:www\\.)?objectui\\.org';
229+
230+
/**
231+
* www.objectui.org folded into this site: its pages moved to `/docs/frontend`
232+
* (the ObjectUI SDK and its renderers), into the metadata pages they described,
233+
* and into the generated component reference. Each row is an old objectui.org
234+
* path and the path on THIS site that carries its content now.
235+
*
236+
* The rows are host-scoped (`has: [{ type: 'host' }]`, see `toNextRedirects`):
237+
* they fire only for a request whose host is objectui.org or www.objectui.org,
238+
* and answer a permanent redirect to the same path on `DOCS_SITE_ORIGIN`. So
239+
* they are inert until those domains point at this Vercel project, and they
240+
* can never shadow one of this site's own URLs: `/docs/plugins` on objectui.org
241+
* is the old plugin gallery, `/docs/plugins` here is the plugins section.
242+
*
243+
* Every published path of the old site has a row: the 183 pages under its
244+
* `content/docs` at the fold, by their URL. The final row catches everything
245+
* else the site served (the home page, the playground, `llms.txt`, OG images)
246+
* and sends it to the SDK section's landing page. First match wins, so it stays
247+
* last.
248+
*
249+
* `scripts/check-docs-redirects.mjs` holds this table to the same rules as
250+
* `docsRedirects`, judged on the host the destination is served from: every
251+
* destination resolves to a real page under `content/docs`, and none is a
252+
* source of `docsRedirects` (that would be a second hop).
253+
*/
254+
export const objectuiRedirects = [
255+
// The ObjectUI SDK guide and the renderer-type pages, now under /docs/frontend.
256+
['/docs', '/docs/frontend'],
257+
['/docs/guide/quick-start', '/docs/frontend/quick-start'],
258+
['/docs/guide/building-crud-app', '/docs/frontend/building-crud-app'],
259+
['/docs/guide/architecture-overview', '/docs/frontend/architecture-overview'],
260+
['/docs/guide/schema-overview', '/docs/frontend'],
261+
['/docs/guide/schema-rendering', '/docs/frontend/schema-rendering'],
262+
['/docs/guide/component-registry', '/docs/frontend/component-registry'],
263+
['/docs/guide/fields', '/docs/frontend/fields'],
264+
['/docs/guide/plugins', '/docs/frontend/plugins'],
265+
['/docs/guide/plugin-development', '/docs/frontend/plugin-development'],
266+
['/docs/guide/data-source', '/docs/frontend/data-source'],
267+
['/docs/guide/layout', '/docs/frontend/layout'],
268+
['/docs/guide/theming', '/docs/frontend/theming'],
269+
['/docs/guide/troubleshooting', '/docs/frontend/troubleshooting'],
270+
['/docs/core/schema-renderer', '/docs/frontend/schema-rendering'],
271+
['/docs/layout/app-shell', '/docs/frontend/app-shell'],
272+
['/docs/layout/sidebar-nav', '/docs/frontend/sidebar-nav'],
273+
['/docs/api/schema-reference', '/docs/ui/components'],
274+
['/docs/utilities/cli', '/docs/frontend/cli'],
275+
['/docs/utilities/create-plugin', '/docs/frontend/create-plugin'],
276+
['/docs/utilities/data-objectstack', '/docs/frontend/data-objectstack'],
277+
['/docs/plugins', '/docs/frontend/plugins'],
278+
['/docs/plugins/plugin-calendar', '/docs/frontend/plugins/plugin-calendar'],
279+
['/docs/plugins/plugin-charts', '/docs/frontend/plugins/plugin-charts'],
280+
['/docs/plugins/plugin-chatbot', '/docs/frontend/plugins/plugin-chatbot'],
281+
['/docs/plugins/plugin-dashboard', '/docs/frontend/plugins/plugin-dashboard'],
282+
['/docs/plugins/plugin-detail', '/docs/frontend/plugins/plugin-detail'],
283+
['/docs/plugins/plugin-editor', '/docs/frontend/plugins/plugin-editor'],
284+
['/docs/plugins/plugin-form', '/docs/frontend/plugins/plugin-form'],
285+
['/docs/plugins/plugin-gantt', '/docs/frontend/plugins/plugin-gantt'],
286+
['/docs/plugins/plugin-grid', '/docs/frontend/plugins/plugin-grid'],
287+
['/docs/plugins/plugin-kanban', '/docs/frontend/plugins/plugin-kanban'],
288+
['/docs/plugins/plugin-list', '/docs/frontend/plugins/plugin-list'],
289+
['/docs/plugins/plugin-map', '/docs/frontend/plugins/plugin-map'],
290+
['/docs/plugins/plugin-markdown', '/docs/frontend/plugins/plugin-markdown'],
291+
['/docs/plugins/plugin-report', '/docs/ui/reports'],
292+
['/docs/plugins/plugin-timeline', '/docs/frontend/plugins/plugin-timeline'],
293+
['/docs/plugins/plugin-view', '/docs/frontend/plugins/plugin-view'],
294+
['/docs/components/basic/button-group', '/docs/frontend/renderers#basic'],
295+
['/docs/components/basic/div', '/docs/frontend/renderers#basic'],
296+
['/docs/components/basic/navigation-menu', '/docs/frontend/renderers#basic'],
297+
['/docs/components/basic/pagination', '/docs/frontend/renderers#basic'],
298+
['/docs/components/basic/separator', '/docs/frontend/renderers#basic'],
299+
['/docs/components/basic/sidebar', '/docs/frontend/renderers#basic'],
300+
['/docs/components/complex/carousel', '/docs/frontend/renderers#complex'],
301+
['/docs/components/complex/data-table', '/docs/frontend/renderers#complex'],
302+
['/docs/components/complex/filter-builder', '/docs/frontend/renderers#complex'],
303+
['/docs/components/complex/filter-ui', '/docs/frontend/renderers#complex'],
304+
['/docs/components/complex/resizable', '/docs/frontend/renderers#complex'],
305+
['/docs/components/complex/scroll-area', '/docs/frontend/renderers#complex'],
306+
['/docs/components/complex/sort-ui', '/docs/frontend/renderers#complex'],
307+
['/docs/components/complex/view-switcher', '/docs/frontend/renderers#complex'],
308+
['/docs/components/data-display/avatar', '/docs/frontend/renderers#data-display'],
309+
['/docs/components/data-display/breadcrumb', '/docs/frontend/renderers#data-display'],
310+
['/docs/components/data-display/kbd', '/docs/frontend/renderers#data-display'],
311+
['/docs/components/data-display/list', '/docs/frontend/renderers#data-display'],
312+
['/docs/components/data-display/statistic', '/docs/frontend/renderers#data-display'],
313+
['/docs/components/data-display/tree-view', '/docs/frontend/renderers#data-display'],
314+
['/docs/components/disclosure/collapsible', '/docs/frontend/renderers#disclosure'],
315+
['/docs/components/disclosure/toggle-group', '/docs/frontend/renderers#disclosure'],
316+
['/docs/components/feedback/empty', '/docs/frontend/renderers#feedback'],
317+
['/docs/components/feedback/loading', '/docs/frontend/renderers#feedback'],
318+
['/docs/components/feedback/progress', '/docs/frontend/renderers#feedback'],
319+
['/docs/components/feedback/skeleton', '/docs/frontend/renderers#feedback'],
320+
['/docs/components/feedback/sonner', '/docs/frontend/renderers#feedback'],
321+
['/docs/components/feedback/spinner', '/docs/frontend/renderers#feedback'],
322+
['/docs/components/feedback/toast', '/docs/frontend/renderers#feedback'],
323+
['/docs/components/form/calendar', '/docs/frontend/renderers#form'],
324+
['/docs/components/form/checkbox', '/docs/frontend/renderers#form'],
325+
['/docs/components/form/combobox', '/docs/frontend/renderers#form'],
326+
['/docs/components/form/command', '/docs/frontend/renderers#form'],
327+
['/docs/components/form/date-picker', '/docs/frontend/renderers#form'],
328+
['/docs/components/form/file-upload', '/docs/frontend/renderers#form'],
329+
['/docs/components/form/form', '/docs/frontend/renderers#form'],
330+
['/docs/components/form/input-otp', '/docs/frontend/renderers#form'],
331+
['/docs/components/form/input', '/docs/frontend/renderers#form'],
332+
['/docs/components/form/radio-group', '/docs/frontend/renderers#form'],
333+
['/docs/components/form/select', '/docs/frontend/renderers#form'],
334+
['/docs/components/form/slider', '/docs/frontend/renderers#form'],
335+
['/docs/components/form/switch', '/docs/frontend/renderers#form'],
336+
['/docs/components/form/textarea', '/docs/frontend/renderers#form'],
337+
['/docs/components/form/toggle', '/docs/frontend/renderers#form'],
338+
['/docs/components/layout/aspect-ratio', '/docs/frontend/renderers#layout'],
339+
['/docs/components/layout/page', '/docs/frontend/renderers#layout'],
340+
['/docs/components/navigation/header-bar', '/docs/frontend/renderers#navigation'],
341+
['/docs/components/overlay/alert-dialog', '/docs/frontend/renderers#overlay'],
342+
['/docs/components/overlay/context-menu', '/docs/frontend/renderers#overlay'],
343+
['/docs/components/overlay/dialog', '/docs/frontend/renderers#overlay'],
344+
['/docs/components/overlay/drawer', '/docs/frontend/renderers#overlay'],
345+
['/docs/components/overlay/dropdown-menu', '/docs/frontend/renderers#overlay'],
346+
['/docs/components/overlay/hover-card', '/docs/frontend/renderers#overlay'],
347+
['/docs/components/overlay/menubar', '/docs/frontend/renderers#overlay'],
348+
['/docs/components/overlay/popover', '/docs/frontend/renderers#overlay'],
349+
['/docs/components/overlay/sheet', '/docs/frontend/renderers#overlay'],
350+
['/docs/components/overlay/tooltip', '/docs/frontend/renderers#overlay'],
351+
// Pages merged into the metadata pages. The Console and Studio guides aim at
352+
// where their facts went, never at the retired /docs/ui/{console,studio}
353+
// pages, which redirect themselves (a chain).
354+
['/docs/fields/auto-number', '/docs/data-modeling/field-types#autonumber'],
355+
['/docs/fields/boolean', '/docs/data-modeling/field-types#boolean'],
356+
['/docs/fields/currency', '/docs/data-modeling/field-types#currency'],
357+
['/docs/fields/date', '/docs/data-modeling/field-types#date'],
358+
['/docs/fields/datetime', '/docs/data-modeling/field-types#datetime'],
359+
['/docs/fields/email', '/docs/data-modeling/field-types#email'],
360+
['/docs/fields/file', '/docs/data-modeling/field-types#media-types'],
361+
['/docs/fields/formula', '/docs/data-modeling/field-types#formula'],
362+
['/docs/fields/grid', '/docs/data-modeling/field-types#master_detail'],
363+
['/docs/fields/image', '/docs/data-modeling/field-types#image'],
364+
['/docs/fields/location', '/docs/data-modeling/field-types#location'],
365+
['/docs/fields/lookup', '/docs/data-modeling/field-types#lookup'],
366+
['/docs/fields/number', '/docs/data-modeling/field-types#number'],
367+
['/docs/fields/object', '/docs/data-modeling/field-types#json'],
368+
['/docs/fields/password', '/docs/data-modeling/field-types#password'],
369+
['/docs/fields/percent', '/docs/data-modeling/field-types#percent'],
370+
['/docs/fields/phone', '/docs/data-modeling/field-types#phone'],
371+
['/docs/fields/rich-text', '/docs/data-modeling/field-types#richtext'],
372+
['/docs/fields/select', '/docs/data-modeling/field-types#select'],
373+
['/docs/fields/summary', '/docs/data-modeling/field-types#summary'],
374+
['/docs/fields/text', '/docs/data-modeling/field-types#text'],
375+
['/docs/fields/textarea', '/docs/data-modeling/field-types#textarea'],
376+
['/docs/fields/time', '/docs/data-modeling/field-types#time'],
377+
['/docs/fields/url', '/docs/data-modeling/field-types#url'],
378+
['/docs/fields/user', '/docs/data-modeling/field-types#user'],
379+
['/docs/fields/vector', '/docs/data-modeling/field-types#vector'],
380+
['/docs/fields/widget-props', '/docs/data-modeling/field-types#how-the-console-renders-a-field'],
381+
['/docs/guide/console', '/docs/build-without-code'],
382+
['/docs/guide/metadata-diagnostics', '/docs/deployment/validating-metadata#metadata-diagnostics-on-load'],
383+
['/docs/guide/flow-designer', '/docs/automation/flows'],
384+
['/docs/guide/notifications', '/docs/build-without-code'],
385+
['/docs/guide/slotted-pages', '/docs/ui/pages#record-pages'],
386+
['/docs/guide/record-edit-modes', '/docs/ui/create-vs-edit-form#modal-or-page-editmode'],
387+
['/docs/guide/designing-app-navigation', '/docs/ui/apps#designing-the-navigation'],
388+
['/docs/guide/dashboard-filters', '/docs/ui/dashboards#filter-controls-and-options'],
389+
['/docs/guide/public-forms', '/docs/ui/forms#6-internal-forms-_consoleformsname'],
390+
['/docs/guide/user-state-persistence', '/docs/ui/views#a-users-list-state-never-writes-the-view'],
391+
['/docs/guide/expressions', '/docs/ui/pages#expression-holes-in-element-properties'],
392+
['/docs/guide/print-pages', '/docs/ui/print-pages#print-in-the-browser'],
393+
['/docs/guide/react-pages', '/docs/ui/react-pages'],
394+
['/docs/guide/agent-skills', '/docs/ai/skills#the-skill-catalog'],
395+
['/docs/core/app-schema', '/docs/ui/apps#action-navigation'],
396+
['/docs/core/report-schema', '/docs/ui/reports'],
397+
['/docs/core/enhanced-actions', '/docs/ui/actions#collect-input-and-shape-the-ux'],
398+
['/docs/core/theme-schema', '/docs/ui/apps#branding'],
399+
['/docs/layout/page-header', '/docs/ui/pages#the-page-header'],
400+
// Component pages replaced by the generated component reference.
401+
['/docs/components', '/docs/ui/components'],
402+
['/docs/components/basic/icon', '/docs/ui/components/ui#icon'],
403+
['/docs/components/basic/image', '/docs/ui/components/ui#image'],
404+
['/docs/components/basic/span', '/docs/ui/components/html#span'],
405+
['/docs/components/basic/text', '/docs/ui/components/ui#text'],
406+
['/docs/components/complex/table', '/docs/ui/components/html#table'],
407+
['/docs/components/data-display/alert', '/docs/ui/components/ui#alert'],
408+
['/docs/components/data-display/badge', '/docs/ui/components/ui#badge'],
409+
['/docs/components/disclosure/accordion', '/docs/ui/components/ui#accordion'],
410+
['/docs/components/form/button', '/docs/ui/components/ui#button'],
411+
['/docs/components/form/label', '/docs/ui/components/html#label'],
412+
['/docs/components/layout/box', '/docs/ui/components/ui#box'],
413+
['/docs/components/layout/card', '/docs/ui/components/ui#card'],
414+
['/docs/components/layout/container', '/docs/ui/components/ui#container'],
415+
['/docs/components/layout/flex', '/docs/ui/components/ui#flex'],
416+
['/docs/components/layout/grid', '/docs/ui/components/ui#grid'],
417+
['/docs/components/layout/stack', '/docs/ui/components/ui#stack'],
418+
['/docs/components/layout/tabs', '/docs/ui/components/ui#tabs'],
419+
// Pages deleted outright: the nearest section index.
420+
['/docs/guide', '/docs/frontend'],
421+
['/docs/guide/architecture', '/docs/frontend'],
422+
['/docs/guide/console-architecture', '/docs/frontend'],
423+
['/docs/guide/deployment', '/docs/frontend'],
424+
['/docs/guide/objectos-integration', '/docs/frontend'],
425+
['/docs/guide/release-notes', '/docs/frontend'],
426+
['/docs/guide/schema-catalog', '/docs/frontend'],
427+
['/docs/guide/schema-playground', '/docs/frontend'],
428+
['/docs/blocks', '/docs/frontend'],
429+
['/docs/blocks/authentication', '/docs/frontend'],
430+
['/docs/blocks/dashboard', '/docs/frontend'],
431+
['/docs/blocks/ecommerce', '/docs/frontend'],
432+
['/docs/blocks/forms', '/docs/frontend'],
433+
['/docs/blocks/marketing', '/docs/frontend'],
434+
['/docs/api', '/docs/frontend'],
435+
['/docs/utilities', '/docs/frontend'],
436+
['/docs/utilities/runner', '/docs/frontend'],
437+
['/docs/utilities/vscode-extension', '/docs/frontend'],
438+
['/docs/rfcs/0001-clipboard-paste', '/docs/frontend'],
439+
['/docs/plugins/plugin-ai', '/docs/frontend/plugins'],
440+
['/docs/plugins/plugin-designer', '/docs/frontend/plugins'],
441+
['/docs/plugins/plugin-calendar-view', '/docs/frontend/plugins/plugin-calendar'],
442+
['/docs/components/feedback/toaster', '/docs/frontend/renderers#feedback'],
443+
['/docs/components/layout/semantic', '/docs/frontend/renderers#layout'],
444+
// Everything else the old site served — keep last.
445+
['/:path*', '/docs/frontend'],
446+
];
447+
448+
/** Next.js redirects() entries derived from the three tables above. */
216449
export function toNextRedirects() {
217-
return [...docsRedirects, ...blogRedirects].map(([source, destination]) => ({
450+
// The host-scoped rows come first: a request on objectui.org must never fall
451+
// through to a row written for this site's own paths.
452+
const objectui = objectuiRedirects.map(([source, destination]) => ({
218453
source,
219-
destination,
454+
destination: `${DOCS_SITE_ORIGIN}${destination}`,
220455
permanent: true,
456+
has: [{ type: 'host', value: OBJECTUI_HOST_PATTERN }],
221457
}));
458+
return [
459+
...objectui,
460+
...[...docsRedirects, ...blogRedirects].map(([source, destination]) => ({
461+
source,
462+
destination,
463+
permanent: true,
464+
})),
465+
];
222466
}

0 commit comments

Comments
 (0)