mirror of
https://github.com/skoelle/moonweb-site.git
synced 2026-09-17 17:00:25 +00:00
Centralize robots.txt and sitemap
- One robots.txt at root referencing two sitemaps - One central sitemap.xml with all pages (no per-site sitemaps) - Deleted: 4 per-site sitemap templates, 4 per-site robots.txt files - Simplified sitemap template (uses collections.all)
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
User-agent: *
|
||||
Allow: /
|
||||
|
||||
Sitemap: https://www.moonweb.org/code/sitemap.xml
|
||||
@@ -1,6 +0,0 @@
|
||||
---
|
||||
permalink: /code/sitemap.xml
|
||||
sitemapCollection: "code"
|
||||
eleventyExcludeFromCollections: true
|
||||
---
|
||||
{% include "sitemap.njk" %}
|
||||
+2
-4
@@ -27,16 +27,14 @@ module.exports = function (eleventyConfig) {
|
||||
// Root-level shared assets
|
||||
eleventyConfig.addPassthroughCopy({ "shared/base.css": "shared-base.css" });
|
||||
eleventyConfig.addPassthroughCopy({ "shared/favicon/hub.svg": "favicon.svg" });
|
||||
eleventyConfig.addPassthroughCopy({ "hub/robots.txt": "robots.txt" });
|
||||
|
||||
// Per-section assets: favicon, robots.txt
|
||||
// Per-section assets: favicon
|
||||
for (const [section, cfg] of Object.entries(SITES)) {
|
||||
const prefix = cfg.pathPrefix || ".";
|
||||
eleventyConfig.addPassthroughCopy({
|
||||
[`shared/favicon/${section}.svg`]: `${prefix}/favicon.svg`,
|
||||
});
|
||||
eleventyConfig.addPassthroughCopy({
|
||||
[`${section}/robots.txt`]: `${prefix}/robots.txt`,
|
||||
});
|
||||
}
|
||||
|
||||
// Hub: profile photo
|
||||
|
||||
@@ -2,8 +2,4 @@ User-agent: *
|
||||
Allow: /
|
||||
|
||||
Sitemap: https://www.moonweb.org/sitemap.xml
|
||||
Sitemap: https://www.moonweb.org/infra/sitemap.xml
|
||||
Sitemap: https://www.moonweb.org/smarthome/sitemap.xml
|
||||
Sitemap: https://www.moonweb.org/code/sitemap.xml
|
||||
Sitemap: https://www.moonweb.org/retro/sitemap.xml
|
||||
Sitemap: https://www.moonweb.org/timecapsule/sitemap.xml
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
---
|
||||
permalink: /sitemap.xml
|
||||
sitemapCollection: "hub"
|
||||
eleventyExcludeFromCollections: true
|
||||
---
|
||||
{% include "sitemap.njk" %}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
User-agent: *
|
||||
Allow: /
|
||||
|
||||
Sitemap: https://www.moonweb.org/infra/sitemap.xml
|
||||
@@ -1,6 +0,0 @@
|
||||
---
|
||||
permalink: /infra/sitemap.xml
|
||||
sitemapCollection: "infra"
|
||||
eleventyExcludeFromCollections: true
|
||||
---
|
||||
{% include "sitemap.njk" %}
|
||||
@@ -1,4 +0,0 @@
|
||||
User-agent: *
|
||||
Allow: /
|
||||
|
||||
Sitemap: https://www.moonweb.org/retro/sitemap.xml
|
||||
@@ -1,6 +0,0 @@
|
||||
---
|
||||
permalink: /retro/sitemap.xml
|
||||
sitemapCollection: "retro"
|
||||
eleventyExcludeFromCollections: true
|
||||
---
|
||||
{% include "sitemap.njk" %}
|
||||
@@ -1,10 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
{%- set sitemapPages = collections[sitemapCollection] if sitemapCollection else collections.all %}
|
||||
{%- for page in sitemapPages %}
|
||||
{%- for page in collections.all %}
|
||||
{%- if not page.url.includes("404") %}
|
||||
<url>
|
||||
<loc>{{ site.url }}{{ pathPrefix }}{{ page.url }}</loc>
|
||||
<loc>{{ site.url }}{{ page.url }}</loc>
|
||||
<lastmod>{{ page.date | date }}</lastmod>
|
||||
<changefreq>{% if page.url == "/" %}weekly{% else %}monthly{% endif %}</changefreq>
|
||||
<priority>{% if page.url == "/" %}1.0{% elif parent %}0.8{% else %}0.7{% endif %}</priority>
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
User-agent: *
|
||||
Allow: /
|
||||
|
||||
Sitemap: https://www.moonweb.org/smarthome/sitemap.xml
|
||||
@@ -1,6 +0,0 @@
|
||||
---
|
||||
permalink: /smarthome/sitemap.xml
|
||||
sitemapCollection: "smarthome"
|
||||
eleventyExcludeFromCollections: true
|
||||
---
|
||||
{% include "sitemap.njk" %}
|
||||
Binary file not shown.
Reference in New Issue
Block a user