0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-13 22:41:32 -05:00

Merge pull request #4923 from ErisDS/nav-trailing-slash

Ensure internal nav items have a trailing slash
This commit is contained in:
Sebastian Gierlinger 2015-02-18 20:40:22 +01:00
commit ca1d97ab43

View file

@ -125,13 +125,16 @@ NavigationController = Ember.Controller.extend({
url = item.get('url').trim(); url = item.get('url').trim();
order = item.get('order'); order = item.get('order');
// is this an internal URL?
match = url.match(blogUrlRegex); match = url.match(blogUrlRegex);
if (match) { if (match) {
if (match[1] === '') { url = match[1];
url = '/';
} else { // if the last char is not a slash, then add one,
url = match[1]; // this also handles the empty case for the homepage
if (url[url.length - 1] !== '/') {
url += '/';
} }
} else if (!validator.isURL(url) && url !== '' && url[0] !== '/') { } else if (!validator.isURL(url) && url !== '' && url[0] !== '/') {
url = '/' + url; url = '/' + url;