← back to Wallpapercanada
rails: build from tags via shared rail-match helper (fix degenerate single-rail collapse)
86eb049dfcf6c677dd2536a5186d16687ddd22ba · 2026-05-26 10:17:54 -0700 · Steve Abrams
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Files touched
M server.jsM site.config.json
Diff
commit 86eb049dfcf6c677dd2536a5186d16687ddd22ba
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Tue May 26 10:17:54 2026 -0700
rails: build from tags via shared rail-match helper (fix degenerate single-rail collapse)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---
server.js | 25 +++++++++++++++++--------
site.config.json | 6 +++---
2 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/server.js b/server.js
index dd438ab..5dbd2f1 100644
--- a/server.js
+++ b/server.js
@@ -19,6 +19,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 : [];
@@ -174,19 +175,27 @@ app.get('/api/products', (req, res) => {
// (replaced) old: pages: Math.ceil(total / lim), items: list.slice(start, start + lim) });
});
+// Editorial display labels for each rail key.
+const RAIL_LABELS = {
+ textured: 'Textured Wallcoverings',
+ contemporary: 'Contemporary',
+ vinyl: 'Vinyl & Washable',
+ beige: 'Warm Neutrals',
+ traditional: 'Traditional Patterns',
+ paper: 'Paper Wallcoverings',
+};
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 });
+ const rails = buildRails(PRODUCTS_NICHE, SITE_RAILS).map(r => ({
+ ...r,
+ label: RAIL_LABELS[r.key] || r.key,
+ }));
+ res.json({ 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 966bff8..3e5a478 100644
--- a/site.config.json
+++ b/site.config.json
@@ -10,11 +10,11 @@
"accent": "#d4a847"
},
"rails": [
- "architectural",
- "commercial",
"textured",
"contemporary",
"vinyl",
- "woven"
+ "beige",
+ "traditional",
+ "paper"
]
}
← aa91da4 rails: editorial labels for firing aesthetic buckets
·
back to Wallpapercanada
·
fix package-lock name field (stale hospitalitywallpaper from da21eed →