@@ -11,15 +11,19 @@ function collectFamilies(data) {
1111 for ( const project of projects ) {
1212 if ( ! project || typeof project !== "object" ) continue ;
1313
14- const family = project . family ;
14+ // Handle families array
15+ const projectFamilies = project . families || [ "Other" ] ;
16+
1517 const icon = project . icon || "ansys-icon-light.svg" ; // Fallback icon
1618
17- if ( family ) {
18- if ( ! familyData [ family ] ) {
19- familyData [ family ] = { count : 0 , icon : icon } ;
19+ projectFamilies . forEach ( ( family ) => {
20+ if ( family ) {
21+ if ( ! familyData [ family ] ) {
22+ familyData [ family ] = { count : 0 , icon : icon } ;
23+ }
24+ familyData [ family ] . count += 1 ;
2025 }
21- familyData [ family ] . count += 1 ;
22- }
26+ } ) ;
2327 }
2428
2529 return familyData ;
@@ -239,9 +243,23 @@ function applyFilters() {
239243 const projectCards = document . querySelectorAll ( ".project-card" ) ;
240244
241245 projectCards . forEach ( ( card ) => {
242- const family = card . getAttribute ( "data-family" ) . toLowerCase ( ) ;
243- const rawTags = card . getAttribute ( "data-tags" ) ;
246+ // Handle families from data attributes
247+ const rawFamilies = card . getAttribute ( "data-families" ) ;
248+ let cardFamilies = [ ] ;
249+
250+ if ( rawFamilies ) {
251+ try {
252+ // Parse as JSON array
253+ cardFamilies = JSON . parse ( rawFamilies . replace ( / ' / g, '"' ) ) . map (
254+ ( family ) => family . toLowerCase ( ) ,
255+ ) ;
256+ } catch ( error ) {
257+ // Fallback to treating as single family string
258+ cardFamilies = [ rawFamilies . toLowerCase ( ) ] ;
259+ }
260+ }
244261
262+ const rawTags = card . getAttribute ( "data-tags" ) ;
245263 let cardTags = [ ] ;
246264 if ( rawTags ) {
247265 try {
@@ -255,7 +273,10 @@ function applyFilters() {
255273
256274 // Check if the card matches the selected families
257275 const matchesAllFamilies =
258- selectedFamilies . length === 0 || selectedFamilies . includes ( family ) ;
276+ selectedFamilies . length === 0 ||
277+ selectedFamilies . some ( ( selectedFamily ) =>
278+ cardFamilies . includes ( selectedFamily ) ,
279+ ) ;
259280
260281 // Check if the card matches the selected tags
261282 const matchesAllTags =
0 commit comments