-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsitemap.xml.njk
33 lines (32 loc) · 1013 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
26
27
28
29
30
31
32
33
---
permalink: /sitemap.xml
eleventyExcludeFromCollections: true
siteWideUpdate: 2021-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 regExp = r/tags/g %}
{% set pageDate = page.date | sitemapDateTimeString %}
{% set isHomePage = false %}
{% if absoluteUrl == metadata.url + '/' %}
{% set isHomePage = true %}
{% endif %}
{% if not regExp.test(absoluteUrl) %}
<url>
<loc>{{ absoluteUrl }}</loc>
<changefreq>{{ "daily" if isHomePage else "daily" }}</changefreq>
<priority>{{ "1" if isHomePage else "0.8" }}</priority>
<lastmod>{{ pageDate }}</lastmod>
</url>
{% else %}
<url>
<loc>{{ absoluteUrl }}</loc>
<changefreq>weekly</changefreq>
<priority>0.2</priority>
<lastmod>{{ pageDate }}</lastmod>
</url>
{% endif %}
{%- endfor %}
</urlset>