Feature Request: Get End of URL Segment with dc:url:segment

You want the last part of products/lastpart/ for a specific page.
e.g. {{dc:url:segment index="-1"}}
will grab the last part of the url. maybe -2, -3 could work also to go further back.

if not maybe we could have ability to find total segments and use in the index attribute with another dynamic value to deduct e.g. {{dc:url:segment index="{{dc:url:segment_total subtract=“1”}}"}}

Thanks

image

1 Like

Definitely, we can do something like this. You’ll see this sometime in a point release. Have a great day!

4 Likes

hi charlie,
is there anything like that? how does that work? is there some docu?
thanks in advance

It’s in there. If you use anything that is negative if will look at that end of the segments like samc was describing.

For /account/dashboard, -1 would be dashboard. -2 would be account.
{{dc:url:segment index="-1"}}

No I don’t think there is any documentation. For any of the Dynamic Contents for that matter. I can start that, but there is a lot to go through. I’ll also add in some notes in the placeholder of the index input for that Dynamic Content. Have a great day.