mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Ensure internal nav items have a trailing slash
refs #4535 - all internal urls in ghost have a trailing slash, missing it out will cause nav-current to not work
This commit is contained in:
parent
c944644e0d
commit
01dc9bd834
1 changed files with 7 additions and 4 deletions
|
@ -125,13 +125,16 @@ NavigationController = Ember.Controller.extend({
|
|||
url = item.get('url').trim();
|
||||
order = item.get('order');
|
||||
|
||||
// is this an internal URL?
|
||||
match = url.match(blogUrlRegex);
|
||||
|
||||
if (match) {
|
||||
if (match[1] === '') {
|
||||
url = '/';
|
||||
} else {
|
||||
url = match[1];
|
||||
url = match[1];
|
||||
|
||||
// if the last char is not a slash, then add one,
|
||||
// this also handles the empty case for the homepage
|
||||
if (url[url.length - 1] !== '/') {
|
||||
url += '/';
|
||||
}
|
||||
} else if (!validator.isURL(url) && url !== '' && url[0] !== '/') {
|
||||
url = '/' + url;
|
||||
|
|
Loading…
Add table
Reference in a new issue