From a90670a36f9576607520c760a871cccc240baf8a Mon Sep 17 00:00:00 2001 From: Ben Dichter Date: Fri, 8 May 2026 13:39:53 -0400 Subject: [PATCH 1/2] Add site-wide Pagefind search bar to navbar Pagefind is already built in the Netlify pipeline; this exposes a search input in the global navbar (separate #site-search element so it doesn't conflict with the existing news-page #search). Adds matching styles for the navbar input and the results drawer, with a mobile fallback that lets the drawer flow inline inside the collapsed menu. Co-Authored-By: Claude Opus 4.7 (1M context) --- assets/css/style.css | 39 +++++++++++++++++++++++++++++ assets/js/main.js | 12 ++++++++- layouts/partials/shared/header.html | 4 ++- 3 files changed, 53 insertions(+), 2 deletions(-) diff --git a/assets/css/style.css b/assets/css/style.css index 1c48a0d..e62a954 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -1083,6 +1083,45 @@ ol.custom-ordered-list li::before { padding: 0 10px !important; } +/* Site-wide search bar in navbar */ +.site-search { + position: relative; + width: 100%; + max-width: 240px; +} +.site-search .pagefind-ui__search-input { + height: 38px; + font-size: 14px; + padding: 6px 12px; + border-radius: 0.5rem; + border: 1px solid #d0d4dd; + background-color: #fff; + width: 100%; +} +.site-search .pagefind-ui__search-clear { + font-size: 13px; +} +.site-search .pagefind-ui__drawer { + position: absolute !important; + top: 44px !important; + right: 0 !important; + left: auto !important; + width: min(420px, 90vw) !important; + max-height: 70vh; + overflow-y: auto; + z-index: 1050; +} +@media (max-width: 991.98px) { + .site-search { + max-width: 100%; + } + .site-search .pagefind-ui__drawer { + position: static !important; + width: 100% !important; + max-height: none; + } +} + /* Contact Us */ .contactP a { color: #171b26 !important; diff --git a/assets/js/main.js b/assets/js/main.js index fa0f6aa..b3fdcde 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -108,7 +108,17 @@ document.addEventListener("DOMContentLoaded", function () { // PageFind Init window.addEventListener('DOMContentLoaded', (event) => { - new PagefindUI({ element: "#search", showSubResults: true }); + if (document.getElementById("search")) { + new PagefindUI({ element: "#search", showSubResults: true }); + } + if (document.getElementById("site-search")) { + new PagefindUI({ + element: "#site-search", + showSubResults: true, + showImages: false, + resetStyles: false, + }); + } }); if (logos) { diff --git a/layouts/partials/shared/header.html b/layouts/partials/shared/header.html index cf6878b..fcca3fb 100644 --- a/layouts/partials/shared/header.html +++ b/layouts/partials/shared/header.html @@ -134,8 +134,10 @@ {{ end }} + + {{ if $navButton }} -