← back to Silverleafwallpaper
rails: tag-aware facet filter (productInRail) so rail drill-down + pills return products (fix regression)
4a4364006555e16fdc33823a402c1e78e70ea756 · 2026-05-26 10:45:59 -0700 · Steve Abrams
Files touched
Diff
commit 4a4364006555e16fdc33823a402c1e78e70ea756
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Tue May 26 10:45:59 2026 -0700
rails: tag-aware facet filter (productInRail) so rail drill-down + pills return products (fix regression)
---
server.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/server.js b/server.js
index fb705e8..508a2ac 100644
--- a/server.js
+++ b/server.js
@@ -20,7 +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 { buildRails, railFacets, productInRail } = 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 : [];
@@ -158,7 +158,7 @@ app.get('/api/products', (req, res) => {
const needle = q.toLowerCase();
list = list.filter(p => (p.title || '').toLowerCase().includes(needle) || (p.tags || []).some(t => t.toLowerCase().includes(needle)));
}
- if (aesthetic && aesthetic !== 'all') list = list.filter(p => p.aesthetic === aesthetic);
+ if (aesthetic && aesthetic !== 'all') list = list.filter(p => productInRail(p, aesthetic));
if (vendor && vendor !== 'all') list = list.filter(p => p.vendor === vendor);
list = sortProducts(list, sort);
const total = list.length;
@@ -182,7 +182,7 @@ app.get('/api/facets', (req, res) => {
const needle = String(q).toLowerCase();
list = list.filter(p => (p.title || '').toLowerCase().includes(needle) || (p.tags || []).some(t => String(t).toLowerCase().includes(needle)));
}
- if (aesthetic && aesthetic !== 'all') list = list.filter(p => p.aesthetic === aesthetic);
+ if (aesthetic && aesthetic !== 'all') list = list.filter(p => productInRail(p, aesthetic));
if (vendor && vendor !== 'all') list = list.filter(p => p.vendor === vendor);
const aesthetics = railFacets(list, SITE_RAILS);
const vendors = {};
← ca347e1 rails: editorial labels for new tag-derived rail keys (index
·
back to Silverleafwallpaper
·
sku-redact: wire shared vendor-id display scrubber 7608e0e →