22972 Posts in 11596 Topics by 2824 members
|Go to End|
4 March 2011 at 8:53am
I've searched the forum a few times now but can't find the answer what i'm looking for..
Why does SilverStripe add a trailing slash at the end of menu links?
Is it necessary and can it be removed? If so, how?
12 March 2011 at 6:57am
there must be some reason why links end with a slash and somehow it has to be possible to remove those 'trailing slashes' in (menu)links..
12 March 2011 at 8:36am
I think if you gave a more two-year-old description with a screen print, a code fragment or one of the "menu links" you are talking about I might have answered - but as it is I really don't understand what it is...
12 March 2011 at 9:31am
Vinnie, the slash is added in SiteTree::RelativeLink($action), which is called by SiteTree::Link($action), in the return statement:
return Controller::join_links($base, '/', $action);
While the slash is not needed (you can try it by removing the trailing / from any of your URLs), it can't be easily removed while keeping the upgrade process simple.
24 March 2012 at 4:38am
I stumbled across this post because I was having trouble linking to a dataobject because of the slash being added. I was doing something like this:
But instead you can customise the Link() method on the data object itself (or page class) - and then just use $Link
I found this solution posted by Uncle Cheese on this post:
|Go to Top|