diff --git a/content/sitemap/sitemap.njk b/content/sitemap/sitemap.njk
index 3f990d6f..8e04ea8c 100644
--- a/content/sitemap/sitemap.njk
+++ b/content/sitemap/sitemap.njk
@@ -3,7 +3,7 @@ layout: layouts/page.njk
---
{# List every content page in the project #}
- {% for entry in collections.all %}
+ {% for entry in collections.allSortedByPathAsc %}
{% if entry.url %}
{{ entry.url }}
{% endif %}
diff --git a/content/sitemap/sitemap.xml.njk b/content/sitemap/sitemap.xml.njk
index 094d8ead..2fa0e0e5 100644
--- a/content/sitemap/sitemap.xml.njk
+++ b/content/sitemap/sitemap.xml.njk
@@ -4,7 +4,7 @@ eleventyExcludeFromCollections: true
---
-{% for page in collections.all %}
+{% for page in collections.allSortedByPathAsc %}
{% if page.url %}
{% set absoluteUrl %}{{ page.url | htmlBaseUrl(metadata.url) }}{% endset %}
diff --git a/eleventy.config.js b/eleventy.config.js
index cba71d0c..b567e36e 100644
--- a/eleventy.config.js
+++ b/eleventy.config.js
@@ -58,6 +58,12 @@ module.exports = function (eleventyConfig) {
.concat(collectionApi.getFilteredByTags("bluehats_posts"));
});
+ eleventyConfig.addCollection("allSortedByPathAsc", function(collectionApi) {
+ return collectionApi.getAll().sort(function(a, b) {
+ return a.inputPath.localeCompare(b.inputPath);
+ });
+ });
+
// Filters
eleventyConfig.addFilter("jsDateObject", function jsDateObject(dateStr, format, zone) {
return DateTime.fromFormat(dateStr, format || "yyyy-LL-dd", {zone: zone || "utc"}).toJSDate();