Conversation
Reads the /blog/* secondary nav's links from an authored content/blog-nav.html fragment (a nav-menu block, same authoring pattern as the primary nav's content/nav.html) instead of the hardcoded SECONDARY_NAV_ITEMS constant, keeping the hardcoded list only as a fallback when the fragment is missing or malformed. Also fixes a latent duplicate-DOM-id bug in nav-menu.js (flyout ids were derived purely from row position, so two nav-menu instances on one page collided) and guards new URL() parsing of nav/secondary-nav metadata so a malformed value can't abort the whole header render. Fixes #69
|
Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
Commits
|
|
The PSI check failure here (mobile LCP on `/blog`) is very likely unrelated to this PR — traced it to the pre-existing, already-tracked #518, which root-causes the LCP to a lazy-loaded, hotlinked `erp.intuit.com` card thumbnail in `blog-cards.js` (unrelated to header/nav-menu). Confirmed via performance trace: header.js's fragment fetches (including the new `/blog-nav`) run in parallel with the LCP image's own load chain, not blocking it, and run-to-run LCP variance on unmodified `main` (2.9s–6.1s) already exceeds any delta seen here. Suggested next step: resolve #518 first, then re-check PSI on this branch. |
|
Blocker fix proposed: #655 |
40a49bf to
0a53fdd
Compare
Summary
/blog/*"Resource center" secondary nav now reads its categories/links from an authoredcontent/blog-nav.htmlfragment (anav-menublock, same pattern as the primary nav'scontent/nav.html), instead of the hardcodedSECONDARY_NAV_ITEMSconstant inheader.js. Marketing can now edit these links in DA without a code change.NAVfallback, so the header always paints.secondary-navpage-metadata key (default/blog-nav) lets a page override the fragment path, mirroring the existingnavmetadata convention.Content update
/blog-nav(singlenav-menublock, 5 categories), link-for-link identical to what's live today onerp.intuit.com/blog's Resource Center nav (verified via live DOM inspection). Already created and previewed — see https://main--intuit-erp--aemsites.aem.page/blog-nav.Bugs fixed along the way
nav-menu.jsgenerated flyout ids asflyout-<row-index>with no cross-instance uniqueness. Once the primary and secondary nav are both rendered fromnav-menu.js-decorated fragments on the same/blog/*page, this produced colliding ids, breakingaria-controls/aria-labelledbyuniqueness. Fixed with a module-level instance counter, prefixing ids asflyout-<instance>-<row>.new URL(): computing the nav/secondary-nav metadata path could throw synchronously on a malformed value; since that computation now sits inside aPromise.allindecorate(), an uncaught throw there would abort the entire header render (not just the nav path in question). Wrapped inresolveNavPath()with a safe fallback, applied to both nav paths.fetchNavMainHTML/fetchSecondaryNavItemsHTML(were near-identical) into a sharedfetchNavMenuBlock(), and addedconsole.warnon both the "fetch threw" and "fragment missing/malformed" failure paths so content QA has a signal instead of a silent fallback.Known follow-up (not in this PR)
blocks/footer/footer.jshas the same unguardednew URL(footerMeta, ...)pattern this PR fixed forheader.js. Pre-existing, unrelated to this issue — worth a separate follow-up.Test plan
npm run lintcleannpx vitest run— same 11 pre-existing failures asmain, unrelated to these files, no regressions/blogrenders the secondary nav from authored content, flyouts open/close correctly, no duplicate ids, fallback verified by temporarily removing the fragmentFixes #69