diff options
Misc Fixes and Updates
Signed-off-by: Marc Pervaz Boocha <mboocha@sudomsg.xyz>
Diffstat (limited to 'src/sitemap.11ty.js')
-rw-r--r-- | src/sitemap.11ty.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/sitemap.11ty.js b/src/sitemap.11ty.js new file mode 100644 index 0000000..5b793cf --- /dev/null +++ b/src/sitemap.11ty.js @@ -0,0 +1,21 @@ +export default class { + data() { + return { + permalink: "/sitemapa.xml", + eleventyExcludeFromCollections: true + }; + } + + render(data) { + const urrlset = data.collections.all + .map((page) => { + const absoluteUrl = this.htmlBaseUrl(page.url, data.metadata.url); + return `<url><loc>${absoluteUrl}</loc><lastmod>${this.htmlDateString(page.date)}</lastmod></url>` + }) + + return `<?xml version="1.0" encoding="utf-8"?> + <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">${urrlset.join('')}</urlset>`; + } +} + + |