diff --git a/src/pages/projects/index.astro b/src/pages/projects/index.astro index 91da40b..5169d83 100644 --- a/src/pages/projects/index.astro +++ b/src/pages/projects/index.astro @@ -19,10 +19,18 @@ import ToggleFilterMenuBtn from "../../components/projects/ToggleFilterMenuBtn"; import { extractUniqueTagsObject } from "../../utils/tagManipulation.js"; -const baseUrl = import.meta.env.BASE_URL; +function shuffleArray(array) { + for (let i = array.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + [array[i], array[j]] = [array[j], array[i]]; // Swap elements + } + return array; +} +const baseUrl = import.meta.env.BASE_URL; const pageTitle = "OSSI-supported projects"; -const allProjects = await getCollection("projects"); +let allProjects = await getCollection("projects"); +allProjects = shuffleArray(allProjects); // uniqueTags is an object where keys = unique tag categories, values = unique tags within a category, both across allProjects. All lowercase. // used to populate the filter menu