[object Object]

← back to Textilewallpaper

add clean-URL routes (/care, /sourcing, /trade, /history) for extension-less nav

38975922eaff6f020f73fc4186e9c7dba7486c59 · 2026-05-25 21:38:57 -0700 · Steve

Files touched

Diff

commit 38975922eaff6f020f73fc4186e9c7dba7486c59
Author: Steve <steve@designerwallcoverings.com>
Date:   Mon May 25 21:38:57 2026 -0700

    add clean-URL routes (/care, /sourcing, /trade, /history) for extension-less nav
---
 server.js | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/server.js b/server.js
index 6a49c1f..ce946f6 100644
--- a/server.js
+++ b/server.js
@@ -221,6 +221,16 @@ app.get('/about', (req, res) => {
   res.sendFile(path.join(__dirname, 'public', 'history.html'));
 });
 
+// Clean-URL routes for extension-less nav links in trade/care/sourcing/history pages.
+// Generated only for pages that physically exist in public/ so missing-file targets
+// continue to surface as 404 rather than serve the wrong page.
+['care', 'sourcing', 'trade', 'history'].forEach(slug => {
+  const file = path.join(__dirname, 'public', `${slug}.html`);
+  if (fs.existsSync(file)) {
+    app.get(`/${slug}`, (req, res) => res.sendFile(file));
+  }
+});
+
 // sitemap.xml + robots.txt for SEO
 app.get('/robots.txt', (req, res) => {
   res.type('text/plain').send(`User-agent: *

← 8628be9 /api/facets: total now reflects filtered (q + aesthetic) lis  ·  back to Textilewallpaper  ·  add noopener noreferrer to target=_blank links + window.open acc1a2a →