From a2cd401a2eaba174677321409f62f76610c66d05 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Sun, 9 Jun 2019 20:22:02 +0300 Subject: [PATCH] fix(docs-infra): do not redirect docs URLs on archive deployments (#30894) To avoid showing outdated info (such as events, resources, etc.) but still allow people to see docs for older versions, we redirect non-documentation URLs to `/docs`. Recently(-ish) we have added documentation content under the `/cli/...` and `/start/...` path-prefixes, but we haven't added them to the list of documentation URLs that should not be redirected. As a result, on archive deployments (e.g. https://v7.angular.io/cli), they are redirected to `/docs`, making it impossible to see the documentation for these versions (unless you know about the `?mode=stable` work-around). This commit fixes it by adding `cli` and `start` to the list of documentation URLs that are excluded from redirection. PR Close #30894 --- aio/src/app/app.component.spec.ts | 8 ++++++++ aio/src/app/app.component.ts | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/aio/src/app/app.component.spec.ts b/aio/src/app/app.component.spec.ts index 52c508c911..3380a7f281 100644 --- a/aio/src/app/app.component.spec.ts +++ b/aio/src/app/app.component.spec.ts @@ -837,6 +837,10 @@ describe('AppComponent', () => { initializeTest(false); verifyNoRedirection(); + createTestingModule('start', mode); + initializeTest(false); + verifyNoRedirection(); + createTestingModule('tutorial', mode); initializeTest(false); verifyNoRedirection(); @@ -849,6 +853,10 @@ describe('AppComponent', () => { initializeTest(false); verifyNoRedirection(); + createTestingModule('cli', mode); + initializeTest(false); + verifyNoRedirection(); + createTestingModule('api', mode); initializeTest(false); verifyNoRedirection(); diff --git a/aio/src/app/app.component.ts b/aio/src/app/app.component.ts index f904e14a72..bd30f08b93 100644 --- a/aio/src/app/app.component.ts +++ b/aio/src/app/app.component.ts @@ -122,7 +122,7 @@ export class AppComponent implements OnInit { this.locationService.currentPath.subscribe(path => { // Redirect to docs if we are in archive mode and are not hitting a docs page // (i.e. we have arrived at a marketing page) - if (this.deployment.mode === 'archive' && !/^(docs$|api|guide|tutorial)/.test(path)) { + if (this.deployment.mode === 'archive' && !/^(docs$|api|cli|guide|start|tutorial)/.test(path)) { this.locationService.replace('docs'); } if (path === this.currentPath) {