scripts fix

This commit is contained in:
AJ ONeal 2015-01-23 16:42:01 -07:00
parent 5f02698d0a
commit 562afb3c41
3 changed files with 9 additions and 6 deletions

View File

@ -38,7 +38,7 @@ tags : ['http','url','website']
relative_file : /posts/foo/index.html
# excludes index.html
relative_link : /posts/foo/
relative_href : /posts/foo/
# actual url of this file, even if redirect
# excludes index.html

View File

@ -955,7 +955,7 @@
, author: Desi.num2str(author)
};
desi.allStyles = desi.styles;
desi.allStyles = desi.styles.slice(0);
desi.styles = desi.styles.filter(function (str) {
// TODO better matching
return str.match('/' + themename + '/');
@ -973,10 +973,12 @@
compiled.push({ contents: html, path: path.join(entity.relative_file.replace(env.base_path, '')) });
}
if (/\/index.html$/.test(entity.permalink)) {
entity.redirects.push(entity.permalink.replace(/\/index.html$/, '.html'));
} else if (/\.html$/.test(entity.permalink)) {
entity.redirects.push(entity.permalink.replace(/\.html?$/, '/index.html'));
// catches /a, /a/index.html, a/index.html
// but not index.html /index.html
if (/^.+\/(index\.x?html?)$/.test(entity.permalink)) {
entity.redirects.push(entity.permalink.replace(/\/(index.x?html?)?$/, '.html'));
} else if (/\.x?html?$/.test(entity.permalink)) {
entity.redirects.push(entity.permalink.replace(/\.x?html?$/, '/index.html'));
} else {
// found index, ignoring redirect
}

View File

@ -149,6 +149,7 @@
.replace(/\/$/, '/index.html');
entity.relative_href = path.join(env.base_path, entity.permalink)
.replace(/\/index\.html$/, '/');
entity.relative_link = entity.relative_href;
entity.url = env.base_url + path.join(env.base_path, entity.permalink)
.replace(/\/index\.html$/, '/');