diff --git a/site/build.mjs b/site/build.mjs
index add8466..629f768 100644
--- a/site/build.mjs
+++ b/site/build.mjs
@@ -210,7 +210,8 @@ function readItems() {
if (!subHue.has(i.subcategory)) subHue.set(i.subcategory, SUB_HUES[subHue.size % SUB_HUES.length]);
}
for (const i of items) i.hue = subHue.get(i.subcategory);
- return items.sort((a, b) => (b.updatedAt ?? "").localeCompare(a.updatedAt ?? "") || a.name.localeCompare(b.name));
+ // Newest first, matching the gallery's default sort.
+ return items.sort((a, b) => (b.createdAt ?? "").localeCompare(a.createdAt ?? "") || a.name.localeCompare(b.name));
}
// ---------- page shell ----------
@@ -325,7 +326,7 @@ function indexPage(items, catalog) {
${select("category", "Category", "All categories", categoryOrder, byCategory)}
${select("subcategory", "Sub-category", "All sub-categories", sortedKeys(bySub), bySub)}
${select("platform", "Platform", "All platforms", sortedKeys(byPlatform), byPlatform)}
-
+
diff --git a/site/src/app.js b/site/src/app.js
index a19b74a..36ceada 100644
--- a/site/src/app.js
+++ b/site/src/app.js
@@ -25,14 +25,14 @@
const v = p.get(k);
if (v !== null) els[k].value = v;
}
- if (!els.sort.value) els.sort.value = "updated";
+ if (!els.sort.value) els.sort.value = "newest";
}
function writeState() {
const p = new URLSearchParams();
for (const k of Object.keys(els)) {
const v = els[k].value.trim();
- if (v && !(k === "sort" && v === "updated")) p.set(k, v);
+ if (v && !(k === "sort" && v === "newest")) p.set(k, v);
}
const qs = p.toString();
history.replaceState(null, "", qs ? `?${qs}#gallery` : location.pathname + (location.hash || ""));
@@ -83,7 +83,7 @@
}
function isFiltered() {
- return Object.keys(els).some((k) => (k === "sort" ? els.sort.value !== "updated" : els[k].value.trim() !== ""));
+ return Object.keys(els).some((k) => (k === "sort" ? els.sort.value !== "newest" : els[k].value.trim() !== ""));
}
// Cards in a row share the tallest card's height, so a card with a short title has
@@ -110,7 +110,7 @@
}
function clear() {
- for (const k of Object.keys(els)) els[k].value = k === "sort" ? "updated" : "";
+ for (const k of Object.keys(els)) els[k].value = k === "sort" ? "newest" : "";
render();
els.q.focus();
}