Skip to content

Commit 5df5f87

Browse files
committed
docs: Angular itself only knows links and the address bar
1 parent 6985a42 commit 5df5f87

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ Angular's prerendering (SSG) writes every route into its own folder: the route `
2929
Static hosts see a folder and redirect `/blog/my-article` to `/blog/my-article/`.
3030
So you have to choose:
3131

32-
- **Nice looking URLs, but redirects:** links, canonical tags and sitemap have to use `/blog/my-article`. Every direct visit (search engine, bookmark, shared link) starts with a 301/308 redirect to `/blog/my-article/`, and the Angular router then removes the trailing slash again.
33-
- **No redirects, but trailing slashes everywhere:** links, canonical tags and sitemap have to use `/blog/my-article/`. Pages answer with 200, but every URL ends with a slash, and Angular needs an extra provider to keep it in the address bar: `{ provide: LocationStrategy, useClass: TrailingSlashPathLocationStrategy }` (see [`TrailingSlashPathLocationStrategy`](https://angular.dev/api/common/TrailingSlashPathLocationStrategy)).
32+
- **Nice looking URLs, but redirects:** links have to use `/blog/my-article`. Every direct visit (search engine, bookmark, shared link) starts with a 301/308 redirect to `/blog/my-article/`, and the Angular router then removes the trailing slash again.
33+
- **No redirects, but trailing slashes everywhere:** links have to use `/blog/my-article/`. Pages answer with 200, but every URL ends with a slash, and Angular needs an extra provider to keep it in the address bar: `{ provide: LocationStrategy, useClass: TrailingSlashPathLocationStrategy }` (see [`TrailingSlashPathLocationStrategy`](https://angular.dev/api/common/TrailingSlashPathLocationStrategy)).
3434

3535
### With this builder: nice URLs and good SEO, we deserve both!
3636

3737
The same route becomes `blog/my-article.html`, and hosts like Cloudflare Pages serve it under `/blog/my-article` directly, with status 200.
3838

3939
- **Nice looking URLs:** `/blog/my-article`, without a trailing slash, in links, in the address bar and in the server response alike.
40-
- **Flawless SEO:** every page answers directly with 200. Search engines see no redirect, and the URL they crawl is the same one your canonical tag, hreflang links and sitemap point to.
40+
- **Flawless SEO:** every page answers directly with 200. Search engines see no redirect, and the URL they crawl is the same one your links point to.
4141
- **Old links keep working:** addresses with a trailing slash redirect to the address without it (measured on Cloudflare Pages, see [Hosts](#hosts)).
4242

4343
This is the option proposed in [angular/angular-cli#29173](https://github.com/angular/angular-cli/issues/29173).

0 commit comments

Comments
 (0)