From 4cdeae33e5f25f84108a7663680a513f84ac7513 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Thu, 5 May 2016 22:44:14 -0400 Subject: [PATCH] don't add "page-xxx-" class if trailing slash exists --- src/middleware/render.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/middleware/render.js b/src/middleware/render.js index 0dd0543600..aacc20c281 100644 --- a/src/middleware/render.js +++ b/src/middleware/render.js @@ -98,7 +98,7 @@ module.exports = function(middleware) { }; function buildBodyClass(req) { - var clean = req.path.replace(/^\/api/, '').replace(/^\//, ''); + var clean = req.path.replace(/^\/api/, '').replace(/^\/|\/$/g, ''); var parts = clean.split('/').slice(0, 3); parts.forEach(function(p, index) { parts[index] = index ? parts[0] + '-' + p : 'page-' + (p || 'home');