From 5e046d4d5556c54d12d941ba58c195652aefe56f Mon Sep 17 00:00:00 2001 From: gator Date: Wed, 11 Mar 2026 01:12:40 +0000 Subject: [PATCH] Update header partial with grouped navigation dropdowns --- views/partials/header.ejs | 71 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 2 deletions(-) diff --git a/views/partials/header.ejs b/views/partials/header.ejs index ddb1bfd..e7550a8 100644 --- a/views/partials/header.ejs +++ b/views/partials/header.ejs @@ -15,14 +15,81 @@ + <% + const navItems = (config?.nav || []); + const mainItems = []; + const productItems = []; + const resourceItems = []; + + navItems.forEach((item) => { + const key = `${item.label || ''} ${item.href || ''}`.toLowerCase(); + + if ((item.href || '') === '/') { + mainItems.push(item); + return; + } + + if (/about/.test(key)) { + mainItems.push(item); + return; + } + + if (/shop|training|report/.test(key)) { + productItems.push(item); + return; + } + + if (/literature|testimonial|first|occlusion|news|update|video|media/.test(key)) { + resourceItems.push(item); + return; + } + + mainItems.push(item); + }); + + const uniqueByHref = (arr) => arr.filter((it, idx, src) => src.findIndex(x => x.href === it.href) === idx); + const main = uniqueByHref(mainItems); + const products = uniqueByHref(productItems); + const resources = uniqueByHref(resourceItems); + %> +