@@ -381,7 +381,27 @@ function writeDescription(video) {
381
381
description += `\n🕹️ p5.js Web Editor Sketch: ${ sketchUrls [ 0 ] . urls . p5 } ` ;
382
382
}
383
383
}
384
- if ( repoLink || sketchUrls ?. length > 0 ) description += '\n' ;
384
+
385
+ // Other Code Examples
386
+ const otherCodeExamples = data . codeExamples ?. filter (
387
+ ( ex ) => ! ex . urls . p5 && ! ex . urls . github
388
+ ) ;
389
+ const getURL = ( urls ) =>
390
+ urls . p5 || urls . processing || urls . node || urls . other ;
391
+ if ( otherCodeExamples && otherCodeExamples . length > 0 ) {
392
+ if ( otherCodeExamples . length > 1 ) {
393
+ if ( sketchUrls ?. length > 0 || repoLink ) description += '\n' ;
394
+ description += '\nCode Examples:' ;
395
+ for ( const ex of otherCodeExamples ) {
396
+ description += `\n💻 ${ ex . title } : ${ getURL ( ex . urls ) } ` ;
397
+ }
398
+ } else {
399
+ const ex = otherCodeExamples [ 0 ] ;
400
+ description += `\n💻 Code Example: ${ getURL ( ex . urls ) } ` ;
401
+ }
402
+ }
403
+ if ( repoLink || sketchUrls ?. length > 0 || otherCodeExamples ?. length > 0 )
404
+ description += '\n' ;
385
405
386
406
// Other Parts of this Coding Challenge
387
407
@@ -470,7 +490,6 @@ function writeDescription(video) {
470
490
}
471
491
472
492
// Related Challenges
473
-
474
493
if ( data . relatedChallenges && data . relatedChallenges . length > 0 ) {
475
494
description += `\nRelated Coding Challenges:\n` ;
476
495
for ( const challenge of data . relatedChallenges ) {
@@ -587,7 +606,9 @@ const allTracks = [...mainTracks, ...sideTracks];
587
606
const url = new URL ( video ) ;
588
607
if ( url . hostname == 'thecodingtrain.com' ) {
589
608
const pathName = url . pathname ;
590
- specifiedVideos = videos . filter ( ( data ) => data . urls . includes ( pathName ) ) ;
609
+ specifiedVideos = videos . filter ( ( data ) =>
610
+ data . urls . includes ( pathName . slice ( 1 ) )
611
+ ) ;
591
612
} else {
592
613
const video = resolveYTLink ( url ) ;
593
614
if ( video ) {
0 commit comments