# Sitemaps controller
We need to implement Dymamic sitemaps generation.
## Requirements:
1. entry endpoint: `sitemap.xml` : https://assetmantle.one/sitemap.xml
* It should contain all categories, basic links (static)
* sitemaps should be divided based on categories, like: collections, creater etc.
* Don't hardcode any url, extract the information from the Router object and iterate over routes
2. Each sitemap should be generated on get request with encoding: `encoding='UTF-8'`.
3. Each sitemap should have less than 5K link or less and in order to do so you can name it as : `categories/sitemap-1.xml`, `categories/sitemap-2.xml` and so on.

5. As you create more sub categories, decrease the priority gradually least being 0.5. Priority of all urls in https://assetmantle.one/sitemap.xml should be 1.
* can Also create sub category based on filter parameters.
6. `<loc>` should have complete URL with `https://`
7. Implement `<changefreq>` as hourly for categories and set `<changefreq>` to other static details as daily
8. If last modified detail is available in DB, set `<lastmod>` in W3C Datetime format.
9. Take care of [Entity escaping](https://www.sitemaps.org/protocol.html#escaping).
10. After Sitemap generation check if it is a valid xml, don't use online validators
## Sample:
```
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://www.example.com/</loc>
<lastmod>2005-01-01</lastmod>
<changefreq>monthly</changefreq>
<priority>1</priority>
</url>
<url>
<loc>http://www.example.com/catalog?item=12&desc=vacation_hawaii</loc>
<changefreq>weekly</changefreq>
</url>
<url>
<loc>http://www.example.com/catalog?item=73&desc=vacation_new_zealand</loc>
<lastmod>2004-12-23</lastmod>
<changefreq>weekly</changefreq>
</url>
<url>
<loc>http://www.example.com/catalog?item=74&desc=vacation_newfoundland</loc>
<lastmod>2004-12-23T18:00:15+00:00</lastmod>
<priority>1</priority>
</url>
<url>
<loc>http://www.example.com/catalog?item=83&desc=vacation_usa</loc>
<lastmod>2004-11-23</lastmod>
</url>
</urlset>
```
## References:
1. https://www.sitemaps.org/protocol.html
2. https://github.com/edulify/play-sitemap-module.edulify.com (it's old and in java but can take reference from it)
3. https://stackoverflow.com/questions/8402575/how-to-generate-the-correct-sitemap-namespace-using-jaxb-and-spring-responsebod#answer-8403074
4. Lift framework implementation for sitemaps https://app.assembla.com/wiki/show/liftweb/SiteMap