From a4a494408416333e1759af6792849e39dec391ee Mon Sep 17 00:00:00 2001 From: Claudia Reynders <> Date: Sat, 30 Apr 2022 18:44:04 +0200 Subject: [PATCH] Added a basic sitemap and robots.txt --- src/robots.njk | 12 ++++++++++++ src/sitemap.njk | 17 +++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 src/robots.njk create mode 100644 src/sitemap.njk diff --git a/src/robots.njk b/src/robots.njk new file mode 100644 index 0000000..9d6394a --- /dev/null +++ b/src/robots.njk @@ -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 \ No newline at end of file diff --git a/src/sitemap.njk b/src/sitemap.njk new file mode 100644 index 0000000..bdba63e --- /dev/null +++ b/src/sitemap.njk @@ -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> \ No newline at end of file