Fieldtype

Developer
Supported

Expresso

ExpressionEngine 2, ExpressionEngine 3, ExpressionEngine 4, ExpressionEngine 5

Back to this add-on's main page
View Other Add-ons From PutYourLightsOn

     

You must be logged in to post.

Trailing Slash to Channel URI?

Support (Resolved)

mkohne
mkohne

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
# 1
Developer
PutYourLightsOn

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
# 2
mkohne

Perfect, that’s exactly what I needed. Thanks!

PutYourLightsOn
# 3
Developer
PutYourLightsOn

Sure thing.