Skip to content

Commit a7542ab

Browse files
committed
feature. Generating a sitemap.xml
1 parent f281e04 commit a7542ab

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

content/sitemap.webc

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
# sitemap.webc
3+
layout: null
4+
permalink: sitemap.xml
5+
eleventyExcludeFromCollections: true
6+
---
7+
<script webc:setup>
8+
const siteMapCollection = collections.all;
9+
</script>
10+
11+
<?xml version="1.0" encoding="UTF-8"?>
12+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
13+
<url webc:for="item of siteMapCollection" webc:if="item.data?.excludeFromSitemap !== true || item.data?.excludeFromSitemap === undefined">
14+
<loc @text="metadata.url + item.url"></loc>
15+
</url>
16+
</urlset>

data/metadata.js

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ function GetVersion() {
2222
}
2323

2424
export default {
25+
url: "https://davidwesst.com",
2526
title: "David Wesst",
2627
description: "Tech, games, and creative experiments from the mind of David Wesst. Come for the code, stay for the side quests.",
2728
version: GetVersion(),

0 commit comments

Comments
 (0)