Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@ const yaml = require("js-yaml");

module.exports = (eleventyConfig) => {
eleventyConfig.addShortcode("currentYear", () => new Date().getFullYear());
// Add this line to copy your external assets
eleventyConfig.addPassthroughCopy("src/assets");
// 1. Recognize YAML as a template format
eleventyConfig.addTemplateFormats("yaml");

// 2. Define how to process YAML files
eleventyConfig.addExtension("yaml", {
key: "yaml",
compile: async (inputContent) => {
const data = yaml.load(inputContent);
return async () => {
// This returns the 'content' for the page (the bio)
return data.bio || "";
};
},
Expand All @@ -24,15 +20,10 @@ module.exports = (eleventyConfig) => {
},
});

// 2. The Randomized Collection
eleventyConfig.addCollection("randomPeople", (collectionApi) => {
// Grab all yaml files from the users folder
const people = collectionApi.getFilteredByGlob("src/users/*.yaml");

// Create a copy of the array to avoid mutating the original global collection
const shuffled = [...people];

// Fisher-Yates Shuffle
for (let i = shuffled.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]];
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ _site
node_modules
vendor
.venv
src/assets/css/tailwind.css
src/assets/js/bundle.js
Loading
Loading