generated from google/eleventy-high-performance-blog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sitemap.xml.njk
25 lines (25 loc) · 835 Bytes
/
sitemap.xml.njk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
---
permalink: /sitemap.xml
eleventyExcludeFromCollections: true
siteWideUpdate: 2020-07-12
---
<?xml version="1.0" encoding="utf-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{%- for page in collections.all %}
{% set absoluteUrl %}{{ page.url | url | absoluteUrl(metadata.url) }}{% endset %}
{% set pageDate = page.date | sitemapDateTimeString %}
{% set lastModifiedDate = page.inputPath | lastModifiedDate | sitemapDateTimeString %}
{% set siteWide = siteWideUpdate| sitemapDateTimeString %}
{% set lastmod = siteWide %}
{% if pageDate > lastmod %}
{% set lastmod = pageDate %}
{% endif %}
{% if lastModifiedDate > lastmod %}
{% set lastmod = lastModifiedDate %}
{% endif %}
<url>
<loc>{{ absoluteUrl }}</loc>
<lastmod>{{ lastmod }}</lastmod>
</url>
{%- endfor %}
</urlset>