[object Object]

← back to Jutewallpaper

rails: tag-aware via shared rail-match helper + editorial LABELS (rescue flat grid)

f8940a5126a3ff7043c1f9e71b6d9a0ea5b21478 · 2026-05-26 10:40:05 -0700 · Steve Abrams

- Wired buildRails/railFacets from ../_shared/rail-match.js into /api/sliders + /api/facets
- Replaced aspirational aesthetic-only rails (fine/heavy/dyed/metallic/blended) with 6 tag-matched buckets: grasscloth, sisal, beige, woven, natural texture, textured (54–82% hit rates)
- Added editorial LABELS for all 6 new keys in public/index.html
- Result: 6 rails fire (was 0), each capped at 12 items

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

Files touched

Diff

commit f8940a5126a3ff7043c1f9e71b6d9a0ea5b21478
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Tue May 26 10:40:05 2026 -0700

    rails: tag-aware via shared rail-match helper + editorial LABELS (rescue flat grid)
    
    - Wired buildRails/railFacets from ../_shared/rail-match.js into /api/sliders + /api/facets
    - Replaced aspirational aesthetic-only rails (fine/heavy/dyed/metallic/blended) with 6 tag-matched buckets: grasscloth, sisal, beige, woven, natural texture, textured (54–82% hit rates)
    - Added editorial LABELS for all 6 new keys in public/index.html
    - Result: 6 rails fire (was 0), each capped at 12 items
    
    Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---
 package-lock.json | 13 +++++++++++++
 public/index.html |  2 +-
 server.js         | 12 ++++--------
 site.config.json  | 12 ++++++------
 4 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index 7df6be9..7e3093c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -8,6 +8,7 @@
       "name": "jutewallpaper",
       "version": "0.1.0",
       "dependencies": {
+        "dotenv": "^17.4.2",
         "express": "^4.21.0",
         "helmet": "^8.1.0"
       }
@@ -172,6 +173,18 @@
         "npm": "1.2.8000 || >= 1.4.16"
       }
     },
+    "node_modules/dotenv": {
+      "version": "17.4.2",
+      "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.4.2.tgz",
+      "integrity": "sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==",
+      "license": "BSD-2-Clause",
+      "engines": {
+        "node": ">=12"
+      },
+      "funding": {
+        "url": "https://dotenvx.com"
+      }
+    },
     "node_modules/dunder-proto": {
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
diff --git a/public/index.html b/public/index.html
index 6d9fe32..360de3b 100644
--- a/public/index.html
+++ b/public/index.html
@@ -508,7 +508,7 @@ const HOSTKEY = location.hostname.replace(/\./g, '_');
     if (savedSort) state.sort = savedSort;
   } catch(e){}
 })();
-const LABELS = {"all":"All","natural":"Natural Jute"};
+const LABELS = {"all":"All","natural":"Natural Jute","grasscloth":"Grasscloth","sisal":"Sisal","beige":"Beige & Neutral","woven":"Woven Textures","natural texture":"Natural Texture","textured":"Textured"};
 
 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 435d16f..7b6347a 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 : [];
@@ -182,18 +183,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 0506093..713f9b1 100644
--- a/site.config.json
+++ b/site.config.json
@@ -10,12 +10,12 @@
     "accent": "#c89858"
   },
   "rails": [
-    "fine",
-    "heavy",
-    "natural",
-    "dyed",
-    "metallic",
-    "blended"
+    "grasscloth",
+    "sisal",
+    "beige",
+    "woven",
+    "natural texture",
+    "textured"
   ],
   "port": 9911
 }

← 82d5cac rails: editorial labels for firing aesthetic buckets  ·  back to Jutewallpaper  ·  Revert "rails: tag-aware via shared rail-match helper + edit 3f8097c →