[object Object]

← back to Interiordesignershowroom

seo+integrity: per-page OG images + saved rooms/guides/catalog fully honor suppression & exclude wall paints (Cody-hardened)

85a3efa603e9c81379e036254acb09ad702c7608 · 2026-08-03 10:55:39 -0700 · Steve Abrams

Files touched

Diff

commit 85a3efa603e9c81379e036254acb09ad702c7608
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon Aug 3 10:55:39 2026 -0700

    seo+integrity: per-page OG images + saved rooms/guides/catalog fully honor suppression & exclude wall paints (Cody-hardened)
---
 lib/catalog.js | 2 +-
 lib/rooms.js   | 2 +-
 server.js      | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/catalog.js b/lib/catalog.js
index ac62522..8988ea3 100644
--- a/lib/catalog.js
+++ b/lib/catalog.js
@@ -28,7 +28,7 @@ const AFFILIATE_ENABLED = `NOT EXISTS (
 function buildWhere(f, exclude) {
   // `NOT suppressed` = the product-level hide flag (a brand/item switched OFF in
   // admin, e.g. Honiture). Distinct from AFFILIATE_ENABLED, which hides by source.
-  const where = ['in_stock', 'NOT suppressed', AFFILIATE_ENABLED];
+  const where = ['in_stock', 'NOT suppressed', 'is_wall_paint = FALSE', AFFILIATE_ENABLED];
   const params = [];
   for (const d of DIMENSIONS) {
     if (f[d] && d !== exclude) { params.push(f[d]); where.push(`${d} = $${params.length}`); }
diff --git a/lib/rooms.js b/lib/rooms.js
index 7330f99..777cbee 100644
--- a/lib/rooms.js
+++ b/lib/rooms.js
@@ -84,7 +84,7 @@ async function getRoom(slug) {
 }
 
 async function listRooms({ limit = 60 } = {}) {
-  const { rows } = await db.query(`SELECT ${COLS.ROOM} FROM rooms WHERE public ORDER BY featured DESC, created_at DESC LIMIT $1`, [limit]);
+  const { rows } = await db.query(`SELECT ${COLS.ROOM}, (SELECT count(*) FROM products p WHERE p.id = ANY(rooms.product_ids) AND NOT p.suppressed) AS piece_count FROM rooms WHERE public ORDER BY featured DESC, created_at DESC LIMIT $1`, [limit]);
   // attach up to 4 thumbnails per room
   for (const r of rows) {
     r.thumbs = [];
diff --git a/server.js b/server.js
index 3a23149..ed80382 100644
--- a/server.js
+++ b/server.js
@@ -223,7 +223,7 @@ app.get('/guides/:slug', async (req, res, next) => {
     const g = rows[0];
     let picks = [];
     if (g.product_ids && g.product_ids.length) {
-      const r = await db.query(`SELECT ${COLS.PRODUCT} FROM products WHERE id = ANY($1)`, [g.product_ids]);
+      const r = await db.query(`SELECT ${COLS.PRODUCT} FROM products WHERE id = ANY($1) AND NOT suppressed`, [g.product_ids]);
       picks = r.rows;
     }
     const article = { '@context': 'https://schema.org', '@type': 'Article', headline: g.title, description: g.dek, image: g.hero_image ? absUrl(g.hero_image) : undefined, datePublished: g.created_at };
@@ -555,7 +555,7 @@ app.get('/looks', async (_req, res, next) => {
       const thumbHtml = thumbs.length
         ? thumbs.map(t => `<img loading="lazy" src="${esc(t)}" alt="">`).join('')
         : '<div class="noimg">No preview</div>';
-      const pieceCount = (r.product_ids || []).length;
+      const pieceCount = r.piece_count != null ? Number(r.piece_count) : (r.product_ids || []).length;
       const meta = [r.style, r.room_type].filter(Boolean).join(' ');
       return `<a class="look-card" href="/room/${esc(r.slug)}" aria-label="${esc(r.title)}${meta ? ' — ' + meta : ''}">
         <div class="look-thumbs">${thumbHtml}</div>

← 303f890 chore: sync package-lock to v0.4.0  ·  back to Interiordesignershowroom  ·  a11y: working skip-to-content link (focus-moving, tabindex=- 3f3869c →