From c68e9aaf18d33bbdec0390ebdfd910ed10a6d9cd Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 13 Jan 2015 15:24:41 -0700 Subject: [PATCH] fix when base_path is / (in production) --- desirae.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/desirae.js b/desirae.js index fd60c01..9c26b4e 100644 --- a/desirae.js +++ b/desirae.js @@ -717,7 +717,9 @@ , posts: { collated: view.desi.collated } , urls: { base_url: view.env.base_url - , base_path: view.env.base_path + // /something -> good (leading slash) + // / -> bad (trailing slash) + , base_path: view.env.base_path.replace(/^\/$/, '') } , data: { author: { @@ -895,7 +897,7 @@ if (/stylesheets.*\.css/.test(entity.path) && (!/google/.test(entity.path) || /obsid/.test(entity.path))) { // TODO XXX move to a partial desi.assets.push( - '' + '' ); } } @@ -916,8 +918,8 @@ // TODO nested names? navigation.forEach(function (nav) { - nav.href = env.base_path + '/' + nav.name; - nav.path = env.base_path + '/' + nav.name; + nav.href = path.join(env.base_path, nav.name); + nav.path = path.join(env.base_path, nav.name); // path.basename(nav.path, path.extname(nav.path)) if (nav.href.replace(/(\/)?(\/index)?(\.html)?$/i, '') === entity.relative_url.replace(/(\/)?(\/index)?(\.html)?$/i, '')) {