Set routing for sitemap.xml and robots.txt in Angular

The sitemap.xml and robots.txt are not part of Angulars routing per default. That means you cannot access them directly even so they are lying in your root/public folder. You have to explicitly set the routing for your sitemap.xml. Or rather, as everything that needs to be accessed publicly, define it as an asset. Same goes for the robots.txt. Just add both files to your angular.json file in the „assets“ part.

November 7th, 2019