Expresso
ExpressionEngine 2, ExpressionEngine 3, ExpressionEngine 4, ExpressionEngine 5
Back to this add-on's main page
View Other Add-ons From PutYourLightsOn
Trailing Slash to Channel URI?
Support (Resolved)
mkohne
|
Posted: 08 June 2018 09:28 AM |
|
|
|
Hello - I’m working on a site that uses trailing slashes on all of the URLs - http://example.com/page/ - for example. I’m trying to set up the Channel URIs in Expresso to append the trailing slash to the URIs but addings this in the settings doesn’t seem to work.
Is there any way to get these added so that when I create the links in the editor the links will include the trailing slash? For example, I’d want the link to be
<a href="{site_url}template/page/">link</a>
rather than
<a href="{site_url}template/page">link</a>
Thanks for the help.
|
|
|
PutYourLightsOn
|
Posted: 08 June 2018 10:57 AM |
# 1
|
|
Developer
|
There’s no setting for this at present, but you can easily achieve this by adding the following to line 54 in expresso/libraries/expresso_lib.php:
$url .= substr($url, -1) !== '/' ? '/' : ''; // add trailing slash if it doesn't exist
$links[] = array($channel->channel_title.' > '.$entry->title, $url);
This assumes your on the current latest version 5.1.0 of Expresso.
|
|
|
mkohne
|
Posted: 08 June 2018 11:55 AM |
# 2
|
|
|
Perfect, that’s exactly what I needed. Thanks!
|
|
|
PutYourLightsOn
|
Posted: 08 June 2018 03:55 PM |
# 3
|
|
Developer
|
Sure thing.
|
|
|