# Get current page URL slug

**URL:** <https://community.hubspot.com/t/get-current-page-url-slug/13300>\
**Category:** CMS Development\
**Created:** [March 1, 2019, 2:01pm UTC](https://community.hubspot.com/t/get-current-page-url-slug/13300 "2019-03-01T14:01:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amit\_95](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/amit_95/32/74736_2.png) [@Amit\_95](https://community.hubspot.com/u/Amit_95)\
**Post date:** [March 1, 2019, 2:01pm UTC](https://community.hubspot.com/t/get-current-page-url-slug/13300/1 "2019-03-01T14:01:22Z")

</div>

I want to get the slug from the current page. Do do this I’m using `{{ request.path }}`.

Currently, when executing `{{ request.path }}` it’ll show me the slug as '/en/pro-test`. How can I get it so that it only shows me `/pro-test`?

---

<div class="post-metadata">

**Author:** ![jzilch](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jzilch/32/2867_2.png) [@jzilch](https://community.hubspot.com/u/jzilch)\
**Post date:** [March 1, 2019, 2:52pm UTC](https://community.hubspot.com/t/get-current-page-url-slug/13300/2 "2019-03-01T14:52:15Z")

</div>

Hi,

Using {{ request.path }} will return the entire path from the URL. I would try and use the split filter found in the HubL docs here. [Accounts Dashboard | HubSpot](https://designers.hubspot.com/docs/hubl/hubl-supported-filters). To split on the ‘/’ and then return just the part of the URL that you want to use.

---

<div class="post-metadata">

**Author:** ![Amit\_95](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/amit_95/32/74736_2.png) [@Amit\_95](https://community.hubspot.com/u/Amit_95)\
**Post date:** [March 1, 2019, 3:40pm UTC](https://community.hubspot.com/t/get-current-page-url-slug/13300/3 "2019-03-01T15:40:51Z")

</div>

So `{{ request.path|split(‘/’) }}`?

With this approach, it prints `/en/[en,%20pro-test]`

---

<div class="post-metadata">

**Author:** ![jzilch](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jzilch/32/2867_2.png) [@jzilch](https://community.hubspot.com/u/jzilch)\
**Post date:** [March 1, 2019, 4:03pm UTC](https://community.hubspot.com/t/get-current-page-url-slug/13300/4 "2019-03-01T16:03:23Z")

</div>

I would also set the second parameter of the split filter to display how many times it should split the URL. Also you will need to return the piece of the URL that you want to use. In this case you can use |last as the piece of the URL of the last item in your sequence.

`{{ request.path|split('/', 2)|last }}`

Something like the above should work for you

---

<div class="post-metadata">

**Author:** ![Amit\_95](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/amit_95/32/74736_2.png) [@Amit\_95](https://community.hubspot.com/u/Amit_95)\
**Post date:** [March 1, 2019, 4:11pm UTC](https://community.hubspot.com/t/get-current-page-url-slug/13300/5 "2019-03-01T16:11:59Z")

</div>

Ah, we’re getting there!

That now spits out “pro-test”. However, I have two translations of this page (English and French). I currently have …

`fr/{{ request.path|split('/', 2)|last }}`

… added to the end of my domain, but it apends “?hsLang=en” to the URL (which results in a 404). Is there a way to remove the last bit too? It’s not defined in my code so guessing it’s HubSpot generated.

---

<div class="post-metadata">

**Author:** ![Indra](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/indra/32/98381_2.png) [@Indra](https://community.hubspot.com/u/Indra)\
**Post date:** [June 22, 2021, 1:57pm UTC](https://community.hubspot.com/t/get-current-page-url-slug/13300/6 "2021-06-22T13:57:17Z")

</div>

[@Amit\_95](https://community.hubspot.com/t5/user/viewprofilepage/user-id/64311) I don’t know if you found your awnser, but to remove the ?hsLang=en, you can disable the ‘Language Specific Redirects’.

You can check out the documentation at:  
[Manage domain language settings](https://knowledge.hubspot.com/domains-and-urls/edit-a-domain-s-language-setting).

Let me know if this solutions works for you.

---

<div class="post-metadata">

**Author:** ![Jake\_Lett](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jake_lett/32/45178_2.png) [@Jake\_Lett](https://community.hubspot.com/u/Jake_Lett)\
**Post date:** [February 10, 2024, 10:05pm UTC](https://community.hubspot.com/t/get-current-page-url-slug/13300/7 "2024-02-10T22:05:57Z")

</div>

If anyone is finding this on the google… this works {{content.slug}}
