Skip to content

Commit

Permalink
Wrap no index (tldraw#4773)
Browse files Browse the repository at this point in the history
This PR adds a (non-lazy) no index wrapping component to the botcom
pages, too.

### Change type

- [x] `improvement`
  • Loading branch information
steveruizok authored Oct 24, 2024
1 parent e43e605 commit e01470f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 26 deletions.
13 changes: 0 additions & 13 deletions apps/dotcom/client/src/pages/noindex.tsx

This file was deleted.

40 changes: 27 additions & 13 deletions apps/dotcom/client/src/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
} from '@tldraw/dotcom-shared'
import { TLRemoteSyncError, TLSyncErrorCloseEventReason } from '@tldraw/sync-core'
import { Suspense, lazy, useEffect } from 'react'
import { Route, createRoutesFromElements, useRouteError } from 'react-router-dom'
import { Helmet } from 'react-helmet-async'
import { Outlet, Route, createRoutesFromElements, useRouteError } from 'react-router-dom'
import { DefaultErrorFallback } from './components/DefaultErrorFallback/DefaultErrorFallback'
import { ErrorPage } from './components/ErrorPage/ErrorPage'
import { notFound } from './pages/not-found'
Expand Down Expand Up @@ -64,7 +65,7 @@ export const router = createRoutesFromElements(
<Route errorElement={<DefaultErrorFallback />}>
<Route path="/" lazy={() => import('./pages/root')} />
{/* We don't want to index multiplayer rooms */}
<Route lazy={() => import('./pages/noindex')}>
<Route element={<NoIndex />}>
<Route path={`/${ROOM_PREFIX}`} lazy={() => import('./pages/new')} />
<Route path="/new" lazy={() => import('./pages/new')} />
<Route path={`/ts-side`} lazy={() => import('./pages/public-touchscreen-side-panel')} />
Expand All @@ -89,20 +90,33 @@ export const router = createRoutesFromElements(
</Route>
</Route>
{/* begin tla */}
<Route lazy={() => import('./tla/providers/TlaRootProviders')}>
<Route path="/q" lazy={() => import('./tla/pages/local')} />
{/* File view */}
<Route path="/q/f/:fileSlug" lazy={() => import('./tla/pages/file')} />
<Route path="/q/p/:fileSlug" lazy={() => import('./tla/pages/publish')} />
{/* Views that require login */}
<Route lazy={() => import('./tla/providers/RequireSignedInUser')}>
{/* User settings */}
<Route path="/q/profile" lazy={() => import('./tla/pages/profile')} />
{/* Internal */}
<Route path="/q/debug" lazy={() => import('./tla/pages/debug')} />
<Route element={<NoIndex />}>
<Route lazy={() => import('./tla/providers/TlaRootProviders')}>
<Route path="/q" lazy={() => import('./tla/pages/local')} />
{/* File view */}
<Route path="/q/f/:fileSlug" lazy={() => import('./tla/pages/file')} />
<Route path="/q/p/:fileSlug" lazy={() => import('./tla/pages/publish')} />
{/* Views that require login */}
<Route lazy={() => import('./tla/providers/RequireSignedInUser')}>
{/* User settings */}
<Route path="/q/profile" lazy={() => import('./tla/pages/profile')} />
{/* Internal */}
<Route path="/q/debug" lazy={() => import('./tla/pages/debug')} />
</Route>
</Route>
</Route>
{/* end tla */}
<Route path="*" lazy={() => import('./pages/not-found')} />
</Route>
)

function NoIndex() {
return (
<>
<Helmet>
<meta name="robots" content="noindex, noimageindex, nofollow" />
</Helmet>
<Outlet />
</>
)
}

0 comments on commit e01470f

Please sign in to comment.