File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,10 @@ const difficulties = {
9090 throw new Error (` ${tutorial .id } is missing difficulty property ` );
9191 }
9292
93- const video = tutorial .collection === " videos" ;
93+ const YOUTUBE_DOMAINS = [" www.youtube.com" , " youtube.com" , " youtu.be" ];
94+ const youtube =
95+ tutorial .collection === " videos" &&
96+ YOUTUBE_DOMAINS .includes (new URL (tutorial .data .link ).hostname );
9497
9598 const spotlight =
9699 tutorial .collection === " docs" && tutorial .data .spotlight ;
@@ -102,16 +105,16 @@ const difficulties = {
102105 },
103106 ];
104107
105- if (video ) {
108+ if (youtube ) {
106109 badges .push ({
107- text: " Video " ,
110+ text: " YouTube " ,
108111 variant: " note" ,
109112 });
110113 }
111114
112115 if (spotlight ) {
113116 badges .push ({
114- text: " Spotlight " ,
117+ text: " Community " ,
115118 variant: " tip" ,
116119 });
117120 }
You can’t perform that action at this time.
0 commit comments