Overview
Why?
Web crawlers usually discover pages from links within the site and from other sites. Sitemaps supplement this data to allow crawlers that support Sitemaps to pick up all URLs in the Sitemap and learn about those URLs using the associated metadata
1. Create sitemap.xml
Go to xml-sitemaps.com. Enter your site url and click START. Follow the instructions and download the generated sitemap. Save as sitemap.xml
in your project /src
folder.
2. Modify angular.json
Open angular.json
and in architect.build.assets
add this line:
"src/sitemap.xml"
3. Modify robots.txt
Open robots.txt
and add this line:
If you don't have robots.txt
, see this page: Robots
4. Test
Build and deploy your project online. Go to a sitemap validator tool, such as validate-xml-sitemap, and test your url.