Compare commits

...

2 Commits

Author SHA1 Message Date
Helen Chong 4e8894a5e4 Change default sitemap change frequency to weekly 2024-08-20 14:52:17 +08:00
Helen Chong 82df281cfb Create sitemap.xml 2024-08-20 14:49:11 +08:00
2 changed files with 16 additions and 1 deletions

View File

@ -7,4 +7,4 @@ Disallow:
{{ robots.txt }} {{ robots.txt }}
Sitemap: {{ sitemeta.siteUrl }}/sitemap/ Sitemap: {{ sitemeta.siteUrl }}/sitemap.xml

15
src/sitemap.xml.njk Normal file
View File

@ -0,0 +1,15 @@
---
permalink: sitemap.xml
eleventyExcludeFromCollections: true
---
<?xml version="1.0" encoding="utf-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{% for item in collections.all -%}
<url>
<loc>{{ sitemeta.siteUrl + item.url | url }}</loc>
<lastmod>{% if item.updated %}{{ item.updated.toISOString() }}{% else %}{{ item.date.toISOString() }}{% endif %}</lastmod>
<changefreq>{{ item.data.sitemap.changefreq | default("weekly") }}</changefreq>
<priority>{{ item.data.sitemap.priority | default(0.5) }}</priority>
</url>
{%- endfor %}
</urlset>