Suggest a way to create a stable sitemap

This commit is contained in:
Daniele Varrazzo 2020-02-24 18:51:50 +00:00
parent 066b23400e
commit ed415b0f10
1 changed files with 2 additions and 2 deletions

View File

@ -38,7 +38,7 @@ skips hidden pages so those will not be generated out.
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{%- for page in [site.root] if page != this recursive %} {%- for page in [site.root] if page != this recursive %}
<url><loc>{{ page|url(external=true) }}</loc></url> <url><loc>{{ page|url(external=true) }}</loc></url>
{{- loop(page.children) }} {{- loop(page.children|sort(attribute='path')) }}
{%- endfor %} {%- endfor %}
</urlset> </urlset>
``` ```
@ -63,7 +63,7 @@ create a `sitemap/contents.lr` file instead and use a template like
{% for page in [site.root] if page.record_label recursive %} {% for page in [site.root] if page.record_label recursive %}
<li><a href="{{ page|url }}">{{ page.record_label }}</a> <li><a href="{{ page|url }}">{{ page.record_label }}</a>
{% if page.children %} {% if page.children %}
<ul>{{ loop(page.children) }}</ul> <ul>{{ loop(page.children|sort(attribute='path')) }}</ul>
{% endif %} {% endif %}
</li> </li>
{% endfor %} {% endfor %}