[object Object]

← back to Stringwallpaper

Add clean-URL routes for editorial nav pages; redirect /about to /history

788c0803505efb367c6be83557904f737aa18ccd · 2026-05-19 08:06:21 -0700 · Steve Abrams

The nav links /care /history /sourcing /trade /vocabulary pointed at
extension-less paths that 404'd (express.static only serves *.html). Added
explicit routes mapping each to its public/<name>.html file. /about had no
target page anywhere, so it 301-redirects to /history (the brand-story page).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit 788c0803505efb367c6be83557904f737aa18ccd
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Tue May 19 08:06:21 2026 -0700

    Add clean-URL routes for editorial nav pages; redirect /about to /history
    
    The nav links /care /history /sourcing /trade /vocabulary pointed at
    extension-less paths that 404'd (express.static only serves *.html). Added
    explicit routes mapping each to its public/<name>.html file. /about had no
    target page anywhere, so it 301-redirects to /history (the brand-story page).
    
    Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---
 server.js | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/server.js b/server.js
index 186c828..1152142 100644
--- a/server.js
+++ b/server.js
@@ -125,6 +125,17 @@ app.use((req, res, next) => {
 });
 app.use(express.static(path.join(__dirname, 'public')));
 
+// Clean-URL routes for extension-less nav links → their static .html pages.
+const CLEAN_PAGES = ['care', 'history', 'sourcing', 'trade', 'vocabulary'];
+for (const name of CLEAN_PAGES) {
+  app.get(`/${name}`, (req, res, next) => {
+    const file = path.join(__dirname, 'public', `${name}.html`);
+    fs.access(file, fs.constants.R_OK, err => err ? next() : res.sendFile(file));
+  });
+}
+// /about has no dedicated page — point it at the brand-history page.
+app.get('/about', (req, res) => res.redirect(301, '/history'));
+
 app.get('/api/products', (req, res) => {
   const { q, aesthetic, vendor, page = 1, limit = 24, sort = 'newest'} = req.query;
   let list = PRODUCTS;

← 119aa24 Untrack snapshot files; broaden .gitignore and add static-ro  ·  back to Stringwallpaper  ·  stage2: wire microsite catalog + admin CRUD + grid/list view 793cc0d →