i created a page extending "ContentPageMetaResolver" that implements PageRobotsResolver
export class MyContentPageMetaResolver extends ContentPageMetaResolver implements
PageRobotsResolver {
pageType = PageType.CONTENT_PAGE;
pageTemplate = 'StaticContentPageTemplate';
resolveRobots(): Observable<PageRobotsMeta[]> {
return of(new Array(PageRobotsMeta.NOFOLLOW, PageRobotsMeta.NOINDEX));
}
}
As a result this is adding the the following entry to the head element of the page:
<meta name="robots" content="NOFOLLOW, NOINDEX">
Now i need to do the same thing for keywords. Any idea how to create a custom resolver implementation ?
The PageRobotsResolver interface is provided out of the box in page.resolvers.d.ts file:
/**
* Resolves the robot information for the page. This is used by
* search engines to understand whether the page and subsequential links
* should be indexed.
*
*/
export interface PageRobotsResolver {
/**
* Resolves the robots for the page.
*
* @deprecated since version 1.3
* Use `resolveRobots()` instead.
*/
resolveRobots(...args: any[]): Observable<PageRobotsMeta[]>;
/**
* Resolves the robots for the page.
*/
resolveRobots(): Observable<PageRobotsMeta[]>;
}
And added the following to my providers list of my module :
@NgModule({
providers: [
{ provide: ContentPageMetaResolver, useExisting: MyContentPageMetaResolver }
]
})