don't add "page-xxx-" class if trailing slash exists

v1.18.x
psychobunny 9 years ago
parent 2ea57e4110
commit 4cdeae33e5

@ -98,7 +98,7 @@ module.exports = function(middleware) {
}; };
function buildBodyClass(req) { 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); var parts = clean.split('/').slice(0, 3);
parts.forEach(function(p, index) { parts.forEach(function(p, index) {
parts[index] = index ? parts[0] + '-' + p : 'page-' + (p || 'home'); parts[index] = index ? parts[0] + '-' + p : 'page-' + (p || 'home');

Loading…
Cancel
Save