# Sitemap.xml - no extra access

**URL:** <https://zola.discourse.group/t/sitemap-xml-no-extra-access/72>\
**Category:** Feature requests\
**Created:** [March 16, 2019, 9:05pm UTC](https://zola.discourse.group/t/sitemap-xml-no-extra-access/72 "2019-03-16T21:05:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![senden9](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/senden9/32/34_2.png) [@senden9](https://zola.discourse.group/u/senden9)\
**Post date:** [March 16, 2019, 9:05pm UTC](https://zola.discourse.group/t/sitemap-xml-no-extra-access/72/1 "2019-03-16T21:05:18Z")

</div>

# tl;dr

Enable access to the `extra` property of pages in the sitemap.xml template.

# Full version

As the [documentation](https://www.getzola.org/documentation/templates/sitemap/) says we get only `permalink` and `date` for a page. The [sitemaps protocol](https://www.sitemaps.org/protocol.html) defines a field called `lastmod`. This should be set to the date the page was _last modified_. Currently zola just set this field to the `date` of the post. This is in many cases not the same as the date.

Example: You post something in an blog. The publishing date is the `date`-field of this blog entry. 7 days later you update some details on this blogpost. The `date` will stay the same but `lastmod` should be updated.

I tried to do this by add an extra field into my content and adapted the sitemap.xml like this

```
  1 {% for page in pages %}
  2 <url>
  3 <loc>{{ page.permalink | safe }}</loc>
  4 {% if page.extra.lastmod %}
  5 <lastmod>{{ page.extra.lastmod }}</lastmod>
  6 {% elif page.date %}
  7 <lastmod>{{ page.date }}</lastmod>
  8 {% endif %}
  9 </url>
 10 {% endfor %}

```

but as we do not have access to the `extra`-context in this template this will not work.  
So i suggest to enable access to the `extra`-content in this template.

---

<div class="post-metadata">

**Author:** ![keats](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@keats](https://zola.discourse.group/u/keats)\
**Post date:** [March 18, 2019, 9:02am UTC](https://zola.discourse.group/t/sitemap-xml-no-extra-access/72/2 "2019-03-18T09:02:12Z")

</div>

Good point, I’ll add that for the next version.  
Sitemap changed significantly in the `next` branch though but it will be simple to add that.

---

<div class="post-metadata">

**Author:** ![keats](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@keats](https://zola.discourse.group/u/keats)\
**Post date:** [March 19, 2019, 8:38pm UTC](https://zola.discourse.group/t/sitemap-xml-no-extra-access/72/3 "2019-03-19T20:38:46Z")

</div>

I pushed it to the `next` branch if you want to give it a try

---

<div class="post-metadata">

**Author:** ![senden9](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/senden9/32/34_2.png) [@senden9](https://zola.discourse.group/u/senden9)\
**Post date:** [March 23, 2019, 6:12pm UTC](https://zola.discourse.group/t/sitemap-xml-no-extra-access/72/4 "2019-03-23T18:12:13Z")

</div>

Works nicely. The default sitemap.xml looks now also much cleaner. Thanks!
