FeaturesSEO
Setup
- Open
config.tsfile and add values forappName,appDescription, anddomainName. These values will be used as default SEO tags.
The helper/services/seo/seo.service.tsadds all the important SEO tags (with your default values) to all pages thanks to the main/app/app.component.tsfile. - To add custom SEO tags to a page without rewriting all the tags, do this:
/app/tos/tos.component.html
... constructor(private seoService: SeoService) {} ngOnInit() { this.initializeSEOTags() } initializeSEOTags() { this.seoService.setTitle('Dashboard | ShipAngular'); this.seoService.setMetaTags([ { name: 'description', content: 'This is an example page description' }, { name: 'keywords', content: 'example, seo, angular' } ]); this.seoService.setCanonicalUrl('https://www.example.com/example-page'); }I recommend settingtitleandcanonicalUrlRelativefor each page. - When relevant, add Structured Data to a page using the
renderSchemaTags()function in/service/seo/seo.service.ts. It helps Google understand your website better and can get you a rich snippet. Open the component for more documentation. Here's an example:{page}.component.ts
config = { appName: 'Your App Name', appDescription: 'Your app description', domainName: 'yourdomain.com' }; constructor(private seoService: SeoService) { } ngOnInit(): void { this.seoService.renderSchemaTags(this.config); }
Claim your domain ownership on Google Search Console to help indexing