Skip to content

Commit

Permalink
fix when base_path is / (in production)
Browse files Browse the repository at this point in the history
  • Loading branch information
AJ ONeal committed Jan 13, 2015
1 parent 4b71063 commit c68e9aa
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions desirae.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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(
'<link href="' + env.base_path + '/themes/' + entity.path + '" type="text/css" rel="stylesheet" media="all">'
'<link href="' + path.join(env.base_path, '/themes/', entity.path) + '" type="text/css" rel="stylesheet" media="all">'
);
}
}
Expand All @@ -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, '')) {
Expand Down

0 comments on commit c68e9aa

Please sign in to comment.