title: Sitemap
---
summary: Quick demo of how to build a custom sitemap.xml.
---
body:
If you want to have a `sitemap.xml` file for search engines this is something
you can very easily create yourself. All you need is a contents file
and a custom template.
## Contents File
First we need to create a contents file. Since `sitemap.xml` always goes
into the same location we create a folder called `sitemap.xml` inside our
`content` folder and add a `contents.lr` file with the following data:
```
_template: sitemap.xml
----
_model: none
```
This instructs Lektor to use the template `sitemap.xml` for this page. We
also give it the empty `none` model for good measure.
!!! Starting with Lektor 2.0 you can also add `_discoverable: no` as a field
into the file to hide it from `.children`. This is useful for such special
pages which should be excluded from navigation or automatic link generation.
## Template File
The template loaded will be `templates/sitemap.xml`. In this file we just
iterate over all pages of the site recursively. This also automatically
skips hidden pages so those will not be generated out.
```xml+jinja