Added a basic sitemap and robots.txt

This commit is contained in:
Claudia Reynders 2022-04-30 18:44:04 +02:00
parent 680516b0d5
commit a4a4944084
2 changed files with 29 additions and 0 deletions

12
src/robots.njk Normal file
View File

@ -0,0 +1,12 @@
---
permalink: '/robots.txt'
eleventyExcludeFromCollections: true
---
User-agent: Baiduspider
User-agent: Baiduspider-video
User-agent: Baiduspider-image
Disallow: /
User-agent: *
Sitemap: /sitemap.xml

17
src/sitemap.njk Normal file
View File

@ -0,0 +1,17 @@
---
permalink: /sitemap.xml
eleventyExcludeFromCollections: true
---
<?xml version="1.0" encoding="utf-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{% for page in collections.all %}
{% set path = page.url | url %}
{% if page.data.title and not page.data.excludeFromSitemap %}
<url>
<loc>{{ site.url }}{{ path }}</loc>
<lastmod>{{ page.date.toISOString() }}</lastmod>
<changefreq>{{ page.data.changeFreq if page.data.changeFreq else "monthly" }}</changefreq>
</url>
{% endif %}
{% endfor %}
</urlset>