@@ -2,18 +2,14 @@ const yaml = require("js-yaml");
22
33module . exports = ( eleventyConfig ) => {
44 eleventyConfig . addShortcode ( "currentYear" , ( ) => new Date ( ) . getFullYear ( ) ) ;
5- // Add this line to copy your external assets
65 eleventyConfig . addPassthroughCopy ( "src/assets" ) ;
7- // 1. Recognize YAML as a template format
86 eleventyConfig . addTemplateFormats ( "yaml" ) ;
97
10- // 2. Define how to process YAML files
118 eleventyConfig . addExtension ( "yaml" , {
129 key : "yaml" ,
1310 compile : async ( inputContent ) => {
1411 const data = yaml . load ( inputContent ) ;
1512 return async ( ) => {
16- // This returns the 'content' for the page (the bio)
1713 return data . bio || "" ;
1814 } ;
1915 } ,
@@ -24,15 +20,10 @@ module.exports = (eleventyConfig) => {
2420 } ,
2521 } ) ;
2622
27- // 2. The Randomized Collection
2823 eleventyConfig . addCollection ( "randomPeople" , ( collectionApi ) => {
29- // Grab all yaml files from the users folder
3024 const people = collectionApi . getFilteredByGlob ( "src/users/*.yaml" ) ;
31-
32- // Create a copy of the array to avoid mutating the original global collection
3325 const shuffled = [ ...people ] ;
3426
35- // Fisher-Yates Shuffle
3627 for ( let i = shuffled . length - 1 ; i > 0 ; i -- ) {
3728 const j = Math . floor ( Math . random ( ) * ( i + 1 ) ) ;
3829 [ shuffled [ i ] , shuffled [ j ] ] = [ shuffled [ j ] , shuffled [ i ] ] ;
0 commit comments