[object Object]

← back to 1900swallpaper

rails: tag-aware via shared rail-match helper + editorial LABELS (fix degenerate single-rail)

d5fdd5dc86f4e89d151a54b0e5e736a748979c29 · 2026-05-26 10:27:42 -0700 · SteveStudio2

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files touched

Diff

commit d5fdd5dc86f4e89d151a54b0e5e736a748979c29
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date:   Tue May 26 10:27:42 2026 -0700

    rails: tag-aware via shared rail-match helper + editorial LABELS (fix degenerate single-rail)
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---
 public/index.html |  2 +-
 server.js         | 12 ++++--------
 site.config.json  | 11 ++++++-----
 3 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/public/index.html b/public/index.html
index 3ae788a..4f53ac2 100644
--- a/public/index.html
+++ b/public/index.html
@@ -509,7 +509,7 @@ const TOUCH = window.matchMedia('(hover: none)').matches;
     document.documentElement.dataset.view = state.view;
   } catch(e){}
 })();
-const LABELS = {"all":"All","art-nouveau":"Art Nouveau"};
+const LABELS = {"all":"All","art-nouveau":"Art Nouveau","floral":"Floral Prints","botanical":"Botanical","traditional":"Traditional","edwardian":"Edwardian","beige":"Warm Neutrals","white":"Light & Airy","gray":"Cool Tones"};
 
 function escAttr(s) { return String(s == null ? '' : s).replace(/[&<>"']/g, c => ({ '&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;' }[c])); }
 // Image-URL allowlist: only DW Shopify CDN + designerwallcoverings.com (defends against XSS via crafted products.json)
diff --git a/server.js b/server.js
index ead859c..ba946ce 100644
--- a/server.js
+++ b/server.js
@@ -20,6 +20,7 @@ if (ADMIN_ENABLED) {
   try { catalog = require('../_shared/admin-catalog'); }
   catch (e) { console.error(`[${__SITE}] admin-catalog unavailable (${e.message}) — falling back to static JSON`); }
 }
+const { buildRails, railFacets } = require('../_shared/rail-match');
 const siteCfg = JSON.parse(fs.readFileSync(path.join(__dirname, 'site.config.json'), 'utf8'));
 const SITE_SLUG = siteCfg.slug || __SITE;
 const SITE_RAILS = Array.isArray(siteCfg.rails) ? siteCfg.rails : [];
@@ -180,18 +181,13 @@ app.get('/api/products', (req, res) => {
 });
 
 app.get('/api/sliders', (req, res) => {
-  const out = [];
-  for (const a of SITE_RAILS) {
-    const items = PRODUCTS_NICHE.filter(p => p.aesthetic === a).slice(0, 12);
-    if (items.length >= 4) out.push({ aesthetic: a, items });
-  }
-  res.json({ rails: out });
+  res.json({ rails: buildRails(PRODUCTS_NICHE, SITE_RAILS) });
 });
 
 app.get('/api/facets', (req, res) => {
-  const aesthetics = {}; const vendors = {};
+  const aesthetics = railFacets(PRODUCTS_NICHE, SITE_RAILS);
+  const vendors = {};
   for (const p of PRODUCTS_NICHE) {
-    aesthetics[p.aesthetic] = (aesthetics[p.aesthetic] || 0) + 1;
     vendors[p.vendor] = (vendors[p.vendor] || 0) + 1;
   }
   res.json({ aesthetics, vendors, total: PRODUCTS_NICHE.length });
diff --git a/site.config.json b/site.config.json
index b6c46c1..39bbabd 100644
--- a/site.config.json
+++ b/site.config.json
@@ -10,11 +10,12 @@
     "accent": "#a89060"
   },
   "rails": [
-    "art-nouveau",
-    "arts-crafts",
-    "edwardian",
     "floral",
-    "craftsman",
-    "damask"
+    "botanical",
+    "traditional",
+    "edwardian",
+    "beige",
+    "white",
+    "gray"
   ]
 }

← fd369c0 rails: editorial labels for firing aesthetic buckets  ·  back to 1900swallpaper  ·  rails: tag-aware facet filter (productInRail) so rail drill- c2b9103 →