@@ -407,11 +407,36 @@ import AjAnimatedMascot from "@/components/AjAnimatedMascot.astro";
407407 curCanonical.setAttribute("href", newCanonical);
408408 }
409409
410- // Update header nav active states
411- const newHeaderNav = doc.querySelector("#site-header nav");
412- const curHeaderNav = document.querySelector("#site-header nav");
413- if (newHeaderNav && curHeaderNav) {
414- curHeaderNav.innerHTML = newHeaderNav.innerHTML;
410+ // Update header nav & mobile active pillar states
411+ const newHeader = doc.getElementById("site-header");
412+ const curHeader = document.getElementById("site-header");
413+ if (newHeader && curHeader) {
414+ const newHeaderNav = newHeader.querySelector("nav");
415+ const curHeaderNav = curHeader.querySelector("nav");
416+ if (newHeaderNav && curHeaderNav) {
417+ curHeaderNav.innerHTML = newHeaderNav.innerHTML;
418+ }
419+ const newBrandLink = newHeader.querySelector('a[href="/"]');
420+ const curBrandLink = curHeader.querySelector('a[href="/"]');
421+ if (newBrandLink && curBrandLink) {
422+ curBrandLink.innerHTML = newBrandLink.innerHTML;
423+ }
424+ const newMobileSlot = newHeader.querySelector("#mobile-active-pillar-slot");
425+ const curMobileSlot = curHeader.querySelector("#mobile-active-pillar-slot");
426+ if (newMobileSlot && curMobileSlot) {
427+ curMobileSlot.innerHTML = newMobileSlot.innerHTML;
428+ }
429+ }
430+ const newDrawer = doc.getElementById("nav-drawer");
431+ const curDrawer = document.getElementById("nav-drawer");
432+ if (newDrawer && curDrawer) {
433+ const newDrawerNavs = newDrawer.querySelectorAll("nav");
434+ const curDrawerNavs = curDrawer.querySelectorAll("nav");
435+ newDrawerNavs.forEach((navEl, idx) => {
436+ if (curDrawerNavs[idx]) {
437+ curDrawerNavs[idx].innerHTML = navEl.innerHTML;
438+ }
439+ });
415440 }
416441
417442 // Close SearchModal or mobile nav drawer if open
@@ -420,9 +445,15 @@ import AjAnimatedMascot from "@/components/AjAnimatedMascot.astro";
420445 searchDialog.close();
421446 document.body.style.overflow = "";
422447 }
423- const mobileNav = document.getElementById("nav-drawer");
424- if (mobileNav && !mobileNav.hidden) {
425- mobileNav.hidden = true;
448+ const mobileNav = document.getElementById("nav-drawer") as HTMLDialogElement | null;
449+ if (mobileNav) {
450+ mobileNav.hidden = false;
451+ mobileNav.removeAttribute("hidden");
452+ if (mobileNav.open && typeof mobileNav.close === "function") {
453+ mobileNav.close();
454+ }
455+ mobileNav.removeAttribute("open");
456+ document.getElementById("nav-drawer-toggle")?.setAttribute("aria-expanded", "false");
426457 document.body.style.overflow = "";
427458 }
428459
@@ -453,8 +484,9 @@ import AjAnimatedMascot from "@/components/AjAnimatedMascot.astro";
453484 // Re-ensure drawer stays open if saved open
454485 syncDrawerFromStorage();
455486
456- // Notify page widgets (e.g. TranscriptModal, Recently Viewed tracker)
487+ // Notify page widgets (e.g. TranscriptModal, Recently Viewed tracker, Courses/Topics filters )
457488 window.dispatchEvent(new CustomEvent("cc:page-load"));
489+ document.dispatchEvent(new CustomEvent("astro:page-load"));
458490 return true;
459491 } catch (err: unknown) {
460492 if (err instanceof Error && err.name === "AbortError") {
@@ -720,17 +752,23 @@ import AjAnimatedMascot from "@/components/AjAnimatedMascot.astro";
720752 }
721753
722754 const internalLinkRegex =
723- / \[ ([^ \] ] + )\]\( ((\/ (?:podcast| post)\/ [a-zA-Z0-9 _\-. ] + ))\) / gi ;
755+ / \[ ([^ \] ] + )\]\( ((\/ (?:podcast| post| course )\/ [a-zA-Z0-9 _\-. \/ ] + ))\) / gi ;
724756 const internalLinks: Array <{
725757 title: string ;
726758 url: string ;
727- type: " podcast" | " post" ;
759+ type: " podcast" | " post" | " course " | " lesson " ;
728760 }> = [];
729761 let intMatch: RegExpExecArray | null ;
730762 while ((intMatch = internalLinkRegex .exec (cleanedText )) !== null ) {
731763 const linkUrl = intMatch [2 ];
732764 const linkTitle = intMatch [1 ];
733- const type = linkUrl .startsWith (" /podcast" ) ? " podcast" : " post" ;
765+ const type = linkUrl .startsWith (" /podcast" )
766+ ? " podcast"
767+ : linkUrl .startsWith (" /course" ) && linkUrl .includes (" /lesson/" )
768+ ? " lesson"
769+ : linkUrl .startsWith (" /course" )
770+ ? " course"
771+ : " post" ;
734772 if (! internalLinks .some ((l ) => l .url === linkUrl )) {
735773 internalLinks .push ({ title: linkTitle , url: linkUrl , type });
736774 }
@@ -832,12 +870,20 @@ import AjAnimatedMascot from "@/components/AjAnimatedMascot.astro";
832870 }
833871 }
834872
873+ const typeBadgeLabel =
874+ link .type === " podcast"
875+ ? " Podcast Episode"
876+ : link .type === " course"
877+ ? " Course"
878+ : link .type === " lesson"
879+ ? " Lesson"
880+ : " Blog Post" ;
835881 cardsHtml += `
836882 <div class="flex flex-col p-2.5 rounded-xl border border-border bg-background/70 hover:border-primary/50 transition-all text-left">
837883 <a href="${link .url }" class="aj-internal-nav group flex items-center justify-between gap-2.5 no-underline">
838884 <div class="min-w-0">
839885 <div class="text-xs font-semibold text-foreground group-hover:text-primary transition-colors truncate">${escapeHtml (link .title )}</div>
840- <div class="text-[10px] font-mono text-muted-foreground uppercase tracking-wider">${isPodcast ? " Podcast Episode " : " Blog Post " }</div>
886+ <div class="text-[10px] font-mono text-muted-foreground uppercase tracking-wider">${typeBadgeLabel }</div>
841887 </div>
842888 <span class="shrink-0 text-xs font-medium text-primary">Open →</span>
843889 </a>
0 commit comments