From 0be08736d54d746bb86ce09ddab6e68e2b1b0f9d Mon Sep 17 00:00:00 2001 From: Ben Dichter Date: Fri, 9 Oct 2026 12:51:57 -0400 Subject: [PATCH 1/4] Check that the Team page buttons exist before attaching handlers main.js attached the "show more" and "show less" handlers without checking that the buttons exist. They are only rendered on the Team page, and only when a group has more than eight members, so the script threw a TypeError on every other page. Most of the diff is re-indentation. Co-Authored-By: Claude Opus 5.5 (1M context) --- assets/js/main.js | 134 ++++++++++++++++++++++++---------------------- 1 file changed, 69 insertions(+), 65 deletions(-) diff --git a/assets/js/main.js b/assets/js/main.js index 84e07cb..b577e24 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -219,85 +219,89 @@ document.addEventListener("DOMContentLoaded", function () { // Show More Team Members // Current Team - showMoreButton.addEventListener("click", function () { - const nextCount = visibleCount + increment; - for (let i = visibleCount; i < nextCount && i < teamMembers.length; i++) { - if (teamMembers[i]) { - teamMembers[i].classList.remove("d-none"); + if (showMoreButton && showLessButton) { + showMoreButton.addEventListener("click", function () { + const nextCount = visibleCount + increment; + for (let i = visibleCount; i < nextCount && i < teamMembers.length; i++) { + if (teamMembers[i]) { + teamMembers[i].classList.remove("d-none"); + } } - } - visibleCount = nextCount; + visibleCount = nextCount; - if (visibleCount > 8) { - showLessButton.classList.remove("d-none"); - } + if (visibleCount > 8) { + showLessButton.classList.remove("d-none"); + } - if (visibleCount >= teamMembers.length) { - showMoreButton.classList.add("d-none"); - } - }); + if (visibleCount >= teamMembers.length) { + showMoreButton.classList.add("d-none"); + } + }); - showLessButton.addEventListener("click", function () { - // Calculate the next set of members to hide - const nextCount = visibleCount - increment; - for (let i = visibleCount - 1; i >= nextCount && i >= 8; i--) { - if (teamMembers[i]) { - teamMembers[i].classList.add("d-none"); + showLessButton.addEventListener("click", function () { + // Calculate the next set of members to hide + const nextCount = visibleCount - increment; + for (let i = visibleCount - 1; i >= nextCount && i >= 8; i--) { + if (teamMembers[i]) { + teamMembers[i].classList.add("d-none"); + } } - } - visibleCount = nextCount; + visibleCount = nextCount; - // Hide the "Show Less" button if only 8 members are visible - if (visibleCount <= 8) { - showLessButton.classList.add("d-none"); - } + // Hide the "Show Less" button if only 8 members are visible + if (visibleCount <= 8) { + showLessButton.classList.add("d-none"); + } - // Show the "Show More" button if not all members are visible - if (visibleCount < teamMembers.length) { - showMoreButton.classList.remove("d-none"); - } - }); + // Show the "Show More" button if not all members are visible + if (visibleCount < teamMembers.length) { + showMoreButton.classList.remove("d-none"); + } + }); + } // Tech Team - showMoreButtonTech.addEventListener("click", function () { - // Calculate the next set of members to show - const nextCountTech = visibleCountTech + incrementTech; - for (let i = visibleCountTech; i < nextCountTech && i < teamMembersTech.length; i++) { - if (teamMembersTech[i]) { - teamMembersTech[i].classList.remove("d-none"); + if (showMoreButtonTech && showLessButtonTech) { + showMoreButtonTech.addEventListener("click", function () { + // Calculate the next set of members to show + const nextCountTech = visibleCountTech + incrementTech; + for (let i = visibleCountTech; i < nextCountTech && i < teamMembersTech.length; i++) { + if (teamMembersTech[i]) { + teamMembersTech[i].classList.remove("d-none"); + } } - } - visibleCountTech = nextCountTech; + visibleCountTech = nextCountTech; - // Show the "Show Less" button if more than 8 members are visible - if (visibleCountTech > 8) { - showLessButtonTech.classList.remove("d-none"); - } + // Show the "Show Less" button if more than 8 members are visible + if (visibleCountTech > 8) { + showLessButtonTech.classList.remove("d-none"); + } - // Hide the "Show More" button if all members are visible - if (visibleCountTech >= teamMembersTech.length) { - showMoreButtonTech.classList.add("d-none"); - } - }); + // Hide the "Show More" button if all members are visible + if (visibleCountTech >= teamMembersTech.length) { + showMoreButtonTech.classList.add("d-none"); + } + }); - showLessButtonTech.addEventListener("click", function () { - // Calculate the next set of members to hide - const nextCountTech = visibleCountTech - incrementTech; - for (let i = visibleCountTech - 1; i >= nextCountTech && i >= 8; i--) { - if (teamMembersTech[i]) { - teamMembersTech[i].classList.add("d-none"); + showLessButtonTech.addEventListener("click", function () { + // Calculate the next set of members to hide + const nextCountTech = visibleCountTech - incrementTech; + for (let i = visibleCountTech - 1; i >= nextCountTech && i >= 8; i--) { + if (teamMembersTech[i]) { + teamMembersTech[i].classList.add("d-none"); + } } - } - visibleCountTech = nextCountTech; + visibleCountTech = nextCountTech; - // Hide the "Show Less" button if only 8 members are visible - if (visibleCountTech <= 8) { - showLessButtonTech.classList.add("d-none"); - } + // Hide the "Show Less" button if only 8 members are visible + if (visibleCountTech <= 8) { + showLessButtonTech.classList.add("d-none"); + } - // Show the "Show More" button if not all members are visible - if (visibleCountTech < teamMembersTech.length) { - showMoreButtonTech.classList.remove("d-none"); - } - }); + // Show the "Show More" button if not all members are visible + if (visibleCountTech < teamMembersTech.length) { + showMoreButtonTech.classList.remove("d-none"); + } + }); + } }); From 03a185539d8484aa49641fc498089666df592c48 Mon Sep 17 00:00:00 2001 From: Ben Dichter Date: Fri, 9 Oct 2026 12:58:26 -0400 Subject: [PATCH 2/4] Load the Bootstrap stylesheet once head.html compiled plugins.scss twice and linked both results: an unminified copy before style.css and a minified copy after it. The second copy repeats every rule of the first later in the cascade, so the first had no effect on rendering. This removes it, which drops a 280 KB render-blocking stylesheet from every page. Co-Authored-By: Claude Opus 5.5 (1M context) --- layouts/partials/essentials/head.html | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/layouts/partials/essentials/head.html b/layouts/partials/essentials/head.html index a3f6b1b..8d50222 100644 --- a/layouts/partials/essentials/head.html +++ b/layouts/partials/essentials/head.html @@ -25,16 +25,6 @@ {{/* Styles */}} -{{ $plugin := slice }} -{{ $plugin := $plugin | append (resources.Get "scss/plugins.scss" | resources.ExecuteAsTemplate "plugins.scss" . | toCSS) }} -{{ $plugin := $plugin | resources.Concat "/css/plugins.css" }} - -{{ if hugo.IsProduction }} - {{ $plugin = $plugin | fingerprint "sha256" }} - {{ $plugin = $plugin | resources.PostProcess }} -{{ end }} - - {{ $styles := dict "transpiler" "libsass" "targetPath" "css/styles.css" }} {{ with resources.Get "css/style.css" | minify | fingerprint }} From 5202bfa4a6f39434d95572cfb1d1d0f5a5797cf9 Mon Sep 17 00:00:00 2001 From: Ben Dichter Date: Fri, 9 Oct 2026 12:58:54 -0400 Subject: [PATCH 3/4] Replace Font Awesome with Bootstrap Icons Every page loaded both icon fonts, and Font Awesome was used for 16 icons on the events, FAQ and Supporting NWB pages. Those now use the equivalent Bootstrap Icons, so the Font Awesome stylesheet (and its 156 KB font on the pages that used it) is no longer loaded. Bootstrap Icons has no brain icon, so the fallback for an activity without a logo on Supporting NWB uses a network diagram instead. Co-Authored-By: Claude Opus 5.5 (1M context) --- layouts/events/list.html | 12 ++++++------ layouts/events/single.html | 14 +++++++------- layouts/faq/single.html | 2 +- layouts/partials/essentials/head.html | 3 --- layouts/supporting-nwb/list.html | 4 ++-- 5 files changed, 16 insertions(+), 19 deletions(-) diff --git a/layouts/events/list.html b/layouts/events/list.html index 94b076c..c6af991 100644 --- a/layouts/events/list.html +++ b/layouts/events/list.html @@ -47,7 +47,7 @@

Up

{{ .Title }}

- + {{ .Date.Format "January 2, 2006" }} {{ if .Params.endDate }} {{ $startDate := .Date.Format "2006-01-02" }} @@ -59,13 +59,13 @@

{{ with .Params.location }}

- + {{ . }}

{{ end }} {{ with .Params.eventType }}

- + {{ . }}

{{ end }} @@ -95,7 +95,7 @@

Pr

{{ .Title }}

- + {{ .Date.Format "January 2, 2006" }} {{ if .Params.endDate }} {{ $startDate := .Date.Format "2006-01-02" }} @@ -107,13 +107,13 @@

{{ with .Params.location }}

- + {{ . }}

{{ end }} {{ with .Params.eventType }}

- + {{ . }}

{{ end }} diff --git a/layouts/events/single.html b/layouts/events/single.html index 5768684..d1d9eda 100644 --- a/layouts/events/single.html +++ b/layouts/events/single.html @@ -24,7 +24,7 @@

{{ .Title | markdownify {{ with .Date }} diff --git a/layouts/faq/single.html b/layouts/faq/single.html index a8c8bbb..2e7d2a6 100644 --- a/layouts/faq/single.html +++ b/layouts/faq/single.html @@ -14,7 +14,7 @@

{{ .Title | markdownify
- Back to FAQ + Back to FAQ diff --git a/layouts/partials/essentials/head.html b/layouts/partials/essentials/head.html index a3f6b1b..c07f84f 100644 --- a/layouts/partials/essentials/head.html +++ b/layouts/partials/essentials/head.html @@ -9,9 +9,6 @@ {{/* Bootstrap Icons */}} -{{/* Font Awesome */}} - - {{/* Netlify Identity Widget */}} diff --git a/layouts/supporting-nwb/list.html b/layouts/supporting-nwb/list.html index 7797168..1611cef 100644 --- a/layouts/supporting-nwb/list.html +++ b/layouts/supporting-nwb/list.html @@ -35,7 +35,7 @@

{{ .title | markdownify }}

- +

{{ .title | markdownify }}

@@ -137,7 +137,7 @@

{{ .title | markdownify }}

{{ .name }} {{ else }}
- +
{{ end }} {{ .name | markdownify }} From fbf58f347f6481bb3be35c3776eb2ad35183633a Mon Sep 17 00:00:00 2001 From: Ben Dichter Date: Fri, 9 Oct 2026 12:59:11 -0400 Subject: [PATCH 4/4] Load Swiper only on the home page The Swiper stylesheet and script (48 KB compressed) were loaded on every page, and only the home page has carousels. They are now included only there, and main.js checks that the library is present before creating the carousels. Co-Authored-By: Claude Opus 5.5 (1M context) --- assets/js/main.js | 110 +++++++++--------- layouts/partials/essentials/head.html | 4 +- .../partials/essentials/script-footer.html | 4 +- 3 files changed, 62 insertions(+), 56 deletions(-) diff --git a/assets/js/main.js b/assets/js/main.js index 84e07cb..3c6f36d 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -46,65 +46,67 @@ document.addEventListener("DOMContentLoaded", function () { - // Swiper Init - const heroSwiper = new Swiper(".heroSwiper", { - slidesPerView: 1, - loop: true, - pagination: { - el: ".swiper-pagination", - dynamicBullets: true, - }, - }); + // Swiper Init (the library is only loaded on pages that have a carousel) + if (typeof Swiper !== "undefined") { + const heroSwiper = new Swiper(".heroSwiper", { + slidesPerView: 1, + loop: true, + pagination: { + el: ".swiper-pagination", + dynamicBullets: true, + }, + }); - const newsSwiper = new Swiper(".newsSwiper", { - slidesPerView: 1, - spaceBetween: 10, - pagination: { - el: ".swiper-pagination", - dynamicBullets: true, - }, - navigation: { - nextEl: ".swiper-button-next", - prevEl: ".swiper-button-prev", - }, - breakpoints: { - 576: { - slidesPerView: 2, - spaceBetween: 20, + const newsSwiper = new Swiper(".newsSwiper", { + slidesPerView: 1, + spaceBetween: 10, + pagination: { + el: ".swiper-pagination", + dynamicBullets: true, }, - 768: { - slidesPerView: 3, - spaceBetween: 20, - } - }, - }); + navigation: { + nextEl: ".swiper-button-next", + prevEl: ".swiper-button-prev", + }, + breakpoints: { + 576: { + slidesPerView: 2, + spaceBetween: 20, + }, + 768: { + slidesPerView: 3, + spaceBetween: 20, + } + }, + }); - const eventsSwiper = new Swiper(".eventsSwiper", { - slidesPerView: 1, - spaceBetween: 10, - pagination: { - el: ".swiper-pagination", - dynamicBullets: true, - }, - navigation: { - nextEl: ".swiper-button-next", - prevEl: ".swiper-button-prev", - }, - breakpoints: { - 576: { - slidesPerView: 2, - spaceBetween: 30, + const eventsSwiper = new Swiper(".eventsSwiper", { + slidesPerView: 1, + spaceBetween: 10, + pagination: { + el: ".swiper-pagination", + dynamicBullets: true, }, - 768: { - slidesPerView: 3, - spaceBetween: 30, + navigation: { + nextEl: ".swiper-button-next", + prevEl: ".swiper-button-prev", }, - 1200: { - slidesPerView: 3, - spaceBetween: 40 - } - }, - }); + breakpoints: { + 576: { + slidesPerView: 2, + spaceBetween: 30, + }, + 768: { + slidesPerView: 3, + spaceBetween: 30, + }, + 1200: { + slidesPerView: 3, + spaceBetween: 40 + } + }, + }); + } // PageFind Init window.addEventListener('DOMContentLoaded', (event) => { diff --git a/layouts/partials/essentials/head.html b/layouts/partials/essentials/head.html index a3f6b1b..8d3e50c 100644 --- a/layouts/partials/essentials/head.html +++ b/layouts/partials/essentials/head.html @@ -15,11 +15,13 @@ {{/* Netlify Identity Widget */}} -{{/* Swiper JS */}} +{{/* Swiper JS (only the home page has carousels) */}} +{{ if .IsHome }} +{{ end }} {{/* Favicon */}} diff --git a/layouts/partials/essentials/script-footer.html b/layouts/partials/essentials/script-footer.html index 2b295a4..cf23655 100644 --- a/layouts/partials/essentials/script-footer.html +++ b/layouts/partials/essentials/script-footer.html @@ -1,5 +1,7 @@ -{{/* Swiper JS */}} +{{/* Swiper JS (only the home page has carousels) */}} +{{ if .IsHome }} +{{ end }} {{/* Scripts */}} {{ with resources.Get "js/plugins.js" }}