From f9a6a94be4c622a6ea1b24ba5776b5add937bdb7 Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Tue, 23 Jan 2018 17:43:58 +0000 Subject: [PATCH] fix(aio): update redirects to fix unwanted 404s (#21712) Closes #21377 PR Close #21712 --- aio/firebase.json | 122 +++++++++++++++++++++++++++-------------- aio/ngsw-manifest.json | 2 +- 2 files changed, 83 insertions(+), 41 deletions(-) diff --git a/aio/firebase.json b/aio/firebase.json index 87e6da0b60..f5493674bd 100644 --- a/aio/firebase.json +++ b/aio/firebase.json @@ -12,50 +12,92 @@ // make sure the routing RegExp in `ngsw-manifest.json` is updated accordingly. ////////////////////////////////////////////////////////////////////////////////////////////// - // cli-quickstart.html, glossary.html, quickstart.html, server-communication.html, style-guide.html - {"type": 301, "source": "/docs/ts/latest/cli-quickstart.html", "destination": "/guide/quickstart"}, - {"type": 301, "source": "/docs/ts/latest/glossary.html", "destination": "/guide/glossary"}, - {"type": 301, "source": "/docs/ts/latest/quickstart.html", "destination": "/guide/quickstart"}, - {"type": 301, "source": "/docs/ts/latest/guide/server-communication.html", "destination": "/guide/http"}, - {"type": 301, "source": "/docs/ts/latest/guide/style-guide.html", "destination": "/guide/styleguide"}, + // A random bad indexed page that used `api/api` + {"type": 301, "source": "api/api/:rest*", "destination": "api/:rest"}, - // guide/cli-quickstart, styleguide + // Guide renames + {"type": 301, "source": "/docs/*/latest/cli-quickstart.html", "destination": "/guide/quickstart"}, + {"type": 301, "source": "/docs/*/latest/glossary.html", "destination": "/guide/glossary"}, + {"type": 301, "source": "/docs/*/latest/quickstart.html", "destination": "/guide/quickstart"}, + {"type": 301, "source": "/docs/*/latest/guide/server-communication.html", "destination": "/guide/http"}, + {"type": 301, "source": "/docs/*/latest/guide/style-guide.html", "destination": "/guide/styleguide"}, {"type": 301, "source": "/guide/cli-quickstart", "destination": "/guide/quickstart"}, - {"type": 301, "source": "/styleguide", "destination": "/guide/styleguide"}, - - // cookbook/a1-a2-quick-reference.html, cookbook/component-communication.html, cookbook/dependency-injection.html - {"type": 301, "source": "/docs/ts/latest/cookbook/a1-a2-quick-reference.html", "destination": "/guide/ajs-quick-reference"}, - {"type": 301, "source": "/docs/ts/latest/cookbook/component-communication.html", "destination": "/guide/component-interaction"}, - {"type": 301, "source": "/docs/ts/latest/cookbook/dependency-injection.html", "destination": "/guide/dependency-injection-in-action"}, - - // cookbook, cookbook/, cookbook/index.html - {"type": 301, "source": "/docs/ts/latest/cookbook", "destination": "/docs"}, - {"type": 301, "source": "/docs/ts/latest/cookbook/", "destination": "/docs"}, - {"type": 301, "source": "/docs/ts/latest/cookbook/index.html", "destination": "/docs"}, - - // cookbook/*.html - {"type": 301, "source": "/docs/ts/latest/cookbook/:cookbook.html", "destination": "/guide/:cookbook"}, - - // docs/ts/latest/api//index/*-.html (+ special case for `NgFor` which has been renamed) - {"type": 301, "source": "/docs/ts/latest/api/common/index/NgFor-directive.html", "destination": "/api/common/NgForOf"}, - {"type": 301, "source": "/docs/ts/latest/api/:package/index/:api-*.html", "destination": "/api/:package/:api"}, - - // docs/ts/latest - {"type": 301, "source": "/docs/ts/latest", "destination": "/docs"}, - - // guide/*, tutorial/*, **/* - {"type": 301, "source": "/docs/ts/latest/:any*", "destination": "/:any*"}, - - // aot-compiler.md and metadata.md combined into aot-compiler.md - issue #19510 - {"type": 301, "source": "/guide/metadata", "destination": "/guide/aot-compiler"}, - - // ngmodule.md renamed to ngmodules.md - {"type": 301, "source": "/guide/ngmodule", "destination": "/guide/ngmodules"}, - - // service-worker-getstart.md, service-worker-comm.md, service-worker-configref.md {"type": 301, "source": "/guide/service-worker-getstart", "destination": "/guide/service-worker-getting-started"}, {"type": 301, "source": "/guide/service-worker-comm", "destination": "/guide/service-worker-communications"}, - {"type": 301, "source": "/guide/service-worker-configref", "destination": "/guide/service-worker-config"} + {"type": 301, "source": "/guide/service-worker-configref", "destination": "/guide/service-worker-config"}, + + // some top level guide pages on old site were moved below the guide folder + {"type": 301, "source": "/styleguide", "destination": "/guide/styleguide"}, + {"type": 301, "source": "/docs/styleguide", "destination": "/guide/styleguide"}, + + // news is now blog + {"type": 301, "source": "/news*", "destination": "https://blog.angular.io/"}, + + // cookbook guides were moved (and sometime renamed or removed) + {"type": 301, "source": "/docs/*/latest/cookbook", "destination": "/docs"}, + {"type": 301, "source": "/docs/*/latest/cookbook/", "destination": "/docs"}, + {"type": 301, "source": "/docs/*/latest/cookbook/index.html", "destination": "/docs"}, + {"type": 301, "source": "/**/cookbook/ts-to-js*", "destination": "https://github.com/angular/angular/blob/master/aio/content/guide/change-log.md#es6--described-in-typescript-to-javascript-2016-11-14"}, + {"type": 301, "source": "/docs/*/latest/cookbook/a1-a2-quick-reference.html", "destination": "/guide/ajs-quick-reference"}, + {"type": 301, "source": "/docs/*/latest/cookbook/component-communication.html", "destination": "/guide/component-interaction"}, + {"type": 301, "source": "/docs/*/latest/cookbook/dependency-injection.html", "destination": "/guide/dependency-injection-in-action"}, + {"type": 301, "source": "/docs/*/latest/cookbook/:cookbook.html", "destination": "/guide/:cookbook"}, + + // Forms related code was moved from the `common` to `forms` package (and NgFor was renamed to NgForOf) + {"type": 301, "source": "/**/NgFor-*", "destination": "/api/common/NgForOf"}, + {"type": 301, "source": "/**/api/common/index/MaxLengthValidator-*", "destination": "/api/forms/MaxLengthValidator"}, + {"type": 301, "source": "/**/api/common/ControlGroup*", "destination": "/api/forms/FormGroup"}, + {"type": 301, "source": "/**/api/common/Control*", "destination": "/api/forms/FormControl"}, + {"type": 301, "source": "/**/api/common/SelectControlValueAccessor-*", "destination": "/api/forms/SelectControlValueAccessor"}, + {"type": 301, "source": "/**/api/common/NgModel", "destination": "/api/forms/NgModel"}, + + // AnimationStateDeclarationMetadata was removed + {"type": 301, "source": "/**/AnimationStateDeclarationMetadata*", "destination": "/api/animation"}, + // `AnimationDriver` was moved to the `animations/browser` package + {"type": 301, "source": "/api/platform-browser/AnimationDriver", "destination": "/api/animations/browser/AnimationDriver"}, + + // The `testing` package was renamed to `core/testing` + {"type": 301, "source": "/api/testing/:api-*", "destination": "/api/core/testing/:api"}, + + // CORE_DIRECTIVES & PLATFORM_PIPES were removed and are now in the CommonModule + {"type": 301, "source": "/**/CORE_DIRECTIVES*", "destination": "/api/common/CommonModule"}, + {"type": 301, "source": "/**/PLATFORM_PIPES*", "destination": "/api/common"}, + + // DirectiveMetadata is now covered by the Directive decorator + {"type": 301, "source": "/**/DirectiveMetadata-*", "destination": "/api/core/Directive"}, + + // HTTP_PROVIDERS was removed and is now provided in HttpModule + {"type": 301, "source": "/**/HTTP_PROVIDERS*", "destination": "/api/http/HttpModule"}, + + // URLs that use the old scheme of adding the type to the end (e.g. `SomeClass-class`) + {"type": 301, "source": "/api/:package/:api-*", "destination": "/api/:package/:api"}, + {"type": 301, "source": "/api/:package/testing/index/:api-*", "destination": "/api/:package/testing/:api"}, + {"type": 301, "source": "/api/:package/testing/:api-*", "destination": "/api/:package/testing/:api"}, + {"type": 301, "source": "/api/upgrade/:package/index/:api-*", "destination": "/api/upgrade/:package/:api"}, + {"type": 301, "source": "/api/upgrade/:package/:api-*", "destination": "/api/upgrade/:package/:api"}, + + // URLs that use the old scheme before we moved the docs to the angular/angular repo + {"type": 301, "source": "/docs/*/latest", "destination": "/docs"}, + {"type": 301, "source": "/docs/*/latest/api/:package", "destination": "/api/:package"}, + {"type": 301, "source": "/docs/*/latest/api/:package/:api-*", "destination": "/api/:package/:api"}, + {"type": 301, "source": "/docs/*/latest/api/:package/index/:api-*", "destination": "/api/:package/:api"}, + {"type": 301, "source": "/docs/*/latest/api/:package/testing", "destination": "/api/:package/testing"}, + {"type": 301, "source": "/docs/*/latest/api/:package/testing/index/:api-*", "destination": "/api/:package/testing/:api"}, + {"type": 301, "source": "/docs/*/latest/api/platform-browser/animations/index/:api-*", "destination": "/api/platform-browser/animations/:api"}, + {"type": 301, "source": "/docs/*/latest/api/testing/:api-*", "destination": "/api/core/testing/:api"}, + {"type": 301, "source": "/docs/*/latest/api/upgrade/:package/:api-*", "destination": "/api/upgrade/:package/:api"}, + {"type": 301, "source": "/docs/*/latest/api/upgrade/:package/index/:api-*", "destination": "/api/upgrade/:package/:api"}, + {"type": 301, "source": "/docs/*/latest/api", "destination": "/api"}, + {"type": 301, "source": "/docs/*/latest/glossary", "destination": "/guide/glossary"}, + {"type": 301, "source": "/docs/*/latest/guide/", "destination": "/guide"}, + {"type": 301, "source": "/docs/*/latest/guide/lifecycle-hooks", "destination": "/guide/lifecycle-hooks"}, + {"type": 301, "source": "/docs/*/latest/:any*", "destination": "/:any*"}, + {"type": 301, "source": "/docs/styleguide*", "destination": "/guide/styleguide"}, + {"type": 301, "source": "/guide/metadata", "destination": "/guide/aot-compiler"}, + {"type": 301, "source": "/guide/ngmodule", "destination": "/guide/ngmodules"}, + {"type": 301, "source": "/guide/learning-angular*", "destination": "/guide/quickstart"}, + {"type": 301, "source": "/testing", "destination": "/guide/testing"}, + {"type": 301, "source": "/testing/**", "destination": "/guide/testing"} ], "rewrites": [ { diff --git a/aio/ngsw-manifest.json b/aio/ngsw-manifest.json index da6ad6af2d..0c132723b9 100644 --- a/aio/ngsw-manifest.json +++ b/aio/ngsw-manifest.json @@ -19,7 +19,7 @@ "routing": { "index": "/index.html", "routes": { - "^(?!/docs/ts/latest|/guide/(?:cli-quickstart|metadata|ngmodule|service-worker-(?:getstart|comm|configref))/?$|/styleguide).*/(?!e?plnkr)[^/.]*$": { + "^(?!/docs/.|(?:/guide/(?:cli-quickstart|metadata|ngmodule|service-worker-(?:getstart|comm|configref)|learning-angular)|/news/?)$|/testing|/api/(?:common/NgModel|platform-browser/AnimationDriver|testing|api)).*/(?!e?plnkr|(?:NgFor|MaxLengthValidator)-|Control(?:Group)?|AnimationStateDeclarationMetadata|CORE_DIRECTIVES|PLATFORM_PIPES|DirectiveMetadata|HTTP_PROVIDERS)[^/.]*$": { "match": "regex" } }