Forum Discussion
1. If you want to get the last part of the URL then you have to split it with "/" and need to fetch only last part like below
<#assign url = http.request.url /> <#assign parts = url?split("/") /> <#assign required_part = parts[(parts?size)-1] /> ${required_part}
It will print the last part of the page URL
11112222
Reviews
LetsInspire
NewAtDigi
2. If there is the single parameter like mentioned in your new URL(https://community.lithium.com?category=123) then you can split it with "=" and get the last part. See here https://prnt.sc/j12wot
3. If you are on blog page or category page and just want to get the last part of the URL then you can use ${coreNode.id}
LMK the exact URL from which you want to get the last part of the URL.
Hi,
I tried as below code in component recent-blog-posts
<#assign url = http.request.url />
<#assign parts = url?split("/") />
<#assign category = parts[(parts?size)-1] />
Hello category ${category}
You can see result at
https://communitystg.digi.com.my/t5/Blog/bg-p/11112222
Hello category = recent-blog-posts?render_behavior=raw&page=1
It should be Hello category = 11112222
Could you please advise how to retrieve 11112222?
Thanks
Related Content
- 7 years ago
- 9 years ago