diff --git a/assets/css/sitemap.css b/assets/css/sitemap.css
index 0ef2bd5..d3d1e4a 100644
--- a/assets/css/sitemap.css
+++ b/assets/css/sitemap.css
@@ -19,4 +19,8 @@ body {
.sitemap-dir > .sitemap-dir {
margin: 0 auto;
padding: 0 0 .5rem 1rem;
+}
+
+.sitemap-dir a {
+ display: block;
}
\ No newline at end of file
diff --git a/content/pages/articles.njk b/content/pages/articles.njk
new file mode 100644
index 0000000..e13b603
--- /dev/null
+++ b/content/pages/articles.njk
@@ -0,0 +1,19 @@
+
+
+
+ {% include "templates/defaultTags.njk" %}
+
+ Site Map
+
+
+
+
+ Here's a list of all articles:
+
+
+ {{ siteMap("/articles") | safe }}
+
+
+
\ No newline at end of file
diff --git a/libs/utils/siteMap.js b/libs/utils/siteMap.js
index 270a80e..9a85dc6 100644
--- a/libs/utils/siteMap.js
+++ b/libs/utils/siteMap.js
@@ -15,14 +15,17 @@ async function handlePath(dirName, siteMap) {
if (fileStats.isDirectory())
siteMap[fullPath.replace(/^[\s\S]+\/pages/, "")] = {
- path: fullPath,
+ path: fullPath.replace(/^[\s\S]+\/pages/, "").replace(/\/.+\//, "/"),
address: fullPath.replace(/^[\s\S]+\/pages/, ""),
type: "directory",
children: await handlePath(fullPath, {})
}
else
+ // Check if it already exists
+ siteMap[fullPath.replace(/^[\s\S]+\/pages/, "").replace(/\.[a-z]+$/, "")] ?
+ siteMap[fullPath.replace(/^[\s\S]+\/pages/, "").replace(/\.[a-z]+$/, "")] :
siteMap[fullPath.replace(/^[\s\S]+\/pages/, "").replace(/\.[a-z]+$/, "")] = {
- path: fullPath,
+ path: fullPath.replace(/^[\s\S]+\/pages/, "").replace(/\.[a-z]+$/, "").replace(/\/.+\//, "/"),
address: fullPath.replace(/^[\s\S]+\/pages/, "").replace(/\.[a-z]+$/, ""),
type: "file"
}
@@ -45,11 +48,11 @@ function renderSiteMap(siteMap, entrypoint) {
continue
if (dir.type === "directory") {
- result.push(`${dir.address}`)
+ result.push(`${dir.path}`)
result.push(renderSiteMap(dir.children, entrypoint))
result.push(``)
} else {
- result.push(`${dir.address}`)
+ result.push(`${dir.path}`)
}
}