Skip to content

feat(router): Add Route.metatags and Route.pageDescription to Route definitions #44928

Open
@twerske

Description

@twerske

Which @angular/* package(s) are relevant/releated to the feature request?

@angular/router

Description

As a follow up to #7630 it would be nice to also add both metatags and pageDescription to the router's definition API in order to streamline how developers define routes.

We can also explore what other data is commonly defined and managed with custom strategies in the Route.data property to see how else we could simplify Route definitions especially for new developers.

Proposed solution

const routes : Routes = {
  path: '', 
  title: 'Angular Home Page', 
  metatags: ['home', 'angular'],
  pageDescription: 'Home page for Angular documentation',
  children: [
    {path: 'about', title: 'About Angular', metatags: ['info', 'about'], pageDescription: 'About page for Angular documentation',},
    {path: 'docs/:param', title: TitleResolver, metatags: MetatagResolver, pageDescription: PageDescriptionResolver}
  ]
};

Alternatives considered

Currently this is individually managed and already possible with the Route.data additional attributes, which works but is more work for the developer and does not enforce best practices.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: routerfeatureIssue that requests a new featurefeature: under considerationFeature request for which voting has completed and the request is now under consideration

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions