diff --git a/content/docs/guides/sitemap/contents.lr b/content/docs/guides/sitemap/contents.lr
index bb34570d..91433041 100644
--- a/content/docs/guides/sitemap/contents.lr
+++ b/content/docs/guides/sitemap/contents.lr
@@ -38,11 +38,16 @@ skips hidden pages so those will not be generated out.
{%- for page in [site.root] if page != this recursive %}
{{ page|url(external=true) }}
- {{- loop(page.children) }}
+ {{- loop(page.children|sort(attribute='path')) }}
{%- endfor %}
```
+Sorting the page using `|sort(attribute='path')` is not mandatory, but can be
+useful if you prefer to have stable builds, for instance if you use `git` to
+version the generated page and would like a clean history or a meaningful diff
+from the last build.
+
Note that because sitemaps need to have external URLs (with scheme and
everything) you will need to configure the `url` of the site before the
template starts working. For more information see [Project File
@@ -63,7 +68,7 @@ create a `sitemap/contents.lr` file instead and use a template like
{% for page in [site.root] if page.record_label recursive %}
{{ page.record_label }}
{% if page.children %}
- {{ loop(page.children) }}
+ {{ loop(page.children|sort(attribute='path')) }}
{% endif %}
{% endfor %}