diff --git a/docs/src/app/routes.ts b/docs/src/app/routes.ts index 0c206987ea5a..af7844550f20 100644 --- a/docs/src/app/routes.ts +++ b/docs/src/app/routes.ts @@ -9,6 +9,13 @@ import {Routes} from '@angular/router'; import {CanActivateComponentSidenav} from './pages/component-sidenav/component-sidenav-can-load-guard'; +function externalRedirect(target: string) { + return () => { + window.location.href = target; + return ''; // unused due to redirect above + }; +} + export const MATERIAL_DOCS_ROUTES: Routes = [ { path: '', @@ -25,6 +32,31 @@ export const MATERIAL_DOCS_ROUTES: Routes = [ // Since https://github.com/angular/components/pull/9574, the cdk-table guide became the overview // document for the cdk table. To avoid any dead / broken links, we redirect to the new location. {path: 'guide/cdk-table', redirectTo: '/cdk/table/overview'}, + // Component harness, drag & drop docs have moved to angular.dev + { + path: 'cdk/testing', + redirectTo: externalRedirect('https://angular.dev/guide/testing/component-harnesses-overview'), + }, + { + path: 'cdk/testing/api', + redirectTo: externalRedirect('https://angular.dev/api#angular_cdk_testing'), + }, + { + path: 'cdk/testing/:tab', + redirectTo: externalRedirect('https://angular.dev/guide/testing/component-harnesses-overview'), + }, + { + path: 'cdk/drag-drop', + redirectTo: externalRedirect('https://angular.dev/guide/drag-drop'), + }, + { + path: 'cdk/drag-drop/api', + redirectTo: externalRedirect('https://angular.dev/api#angular_cdk_drag-drop'), + }, + { + path: 'cdk/drag-drop/:tab', + redirectTo: externalRedirect('https://angular.dev/guide/drag-drop'), + }, // In v19, the theming system became based on system variables and the mat.theme mixin. // The following guides were consolidated into the main theming guide, which redirects // users to v18 docs if they are looking for this content. diff --git a/package.json b/package.json index 82cdfaf3a6cf..7284d5fafe0f 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "build-docs-content": "node --no-warnings=ExperimentalWarning --loader ts-node/esm/transpile-only ./scripts/build-docs-content-main.mts", "build-and-check-release-output": "node --no-warnings=ExperimentalWarning --loader ts-node/esm/transpile-only scripts/build-and-check-release-output.mts", "dev-app": "ibazel run //src/dev-app:devserver", + "docs-app": "ibazel run //docs:serve", "universal-app": "bazel run //src/universal-app:server", "test": "node ./scripts/run-component-tests.js", "test-local": "pnpm -s test --local",