← back to Silkwallpaper
dw-header: hide ANY pre-existing <header> (not just ns-header); title-case bare-slug names
f51642499f130823e7326bc463e17b55d5b9d5fd · 2026-06-01 15:47:49 -0700 · Steve Abrams
Files touched
M public/dw-header.jsM public/index.html
Diff
commit f51642499f130823e7326bc463e17b55d5b9d5fd
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Mon Jun 1 15:47:49 2026 -0700
dw-header: hide ANY pre-existing <header> (not just ns-header); title-case bare-slug names
---
public/dw-header.js | 9 +++++----
public/index.html | 2 +-
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/public/dw-header.js b/public/dw-header.js
index 0f10a0b..d02a7b6 100644
--- a/public/dw-header.js
+++ b/public/dw-header.js
@@ -98,12 +98,13 @@
'<nav class="dwh-drawer" id="dwhNavDrawer" aria-label="Primary">' + linksHTML(NAV) + '</nav>' +
(isAdmin ? '<nav class="dwh-drawer dwh-admin-drawer" id="dwhAdminDrawer" aria-label="Admin tools"><div class="dwh-head">Admin tools</div>' + linksHTML(ADMIN) + '<button type="button" data-act="logout">Sign out admin</button></nav>' : '');
- // remove any pre-existing inline header so we don't double up
- var old = document.querySelector('header.ns-header, header.dwh:not(:first-of-type)');
- if (old && old.className.indexOf('dwh') === -1) old.style.display = 'none';
-
document.body.insertBefore(header, document.body.firstChild);
+ // hide ANY pre-existing site header (ns-header, .header, etc.) so we never double up
+ document.querySelectorAll('header').forEach(function (h) {
+ if (h !== header && h.className.indexOf('dwh') === -1) h.style.display = 'none';
+ });
+
// ---- behaviour ----
function drawer(id) { return document.getElementById(id); }
function close(navId, btnId) { var d = drawer(navId), b = document.getElementById(btnId); if (d) d.classList.remove('open'); if (b) b.setAttribute('aria-expanded', 'false'); }
diff --git a/public/index.html b/public/index.html
index a96dc4b..94c56ed 100644
--- a/public/index.html
+++ b/public/index.html
@@ -1437,7 +1437,7 @@ document.addEventListener('DOMContentLoaded', function(){ try { renderRailSectio
<!-- corner-nav disabled (UL-hamburger rebuild) -->
<script src="/sku-redact.js" defer></script>
<!-- hero-4grid grid DISABLED so the single high-res hero shows full-bleed --><!-- <script src="/hero-4grid.js" defer></script> -->
-<script>window.DwHeaderConfig={siteName:"silkwallpaper",accent:"#9B7B4F",navLinks:[{name:'Home',url:'/'},{name:'Collections',url:'#shop'},{name:'About',url:'/about'},{name:'Care',url:'/care.html'},{name:'History',url:'/history.html'}],adminLinks:[{name:'Shopify admin',url:'https://admin.shopify.com',external:true},{name:'Edit hero',url:'#'},{name:'Analytics',url:'#'}]};</script>
+<script>window.DwHeaderConfig={siteName:"Silk Wallpaper",accent:"#9B7B4F",navLinks:[{name:'Home',url:'/'},{name:'Collections',url:'#shop'},{name:'About',url:'/about'},{name:'Care',url:'/care.html'},{name:'History',url:'/history.html'}],adminLinks:[{name:'Shopify admin',url:'https://admin.shopify.com',external:true},{name:'Edit hero',url:'#'},{name:'Analytics',url:'#'}]};</script>
<script src="/dw-header.js" defer></script>
</body>
</html>
← 95a5554 FIX: dw-header was injected inside a doc-comment (never ran)
·
back to Silkwallpaper
·
fleet rebuild: dw-header (hamburgers UL + centered name) + u 2c15dfe →