[Feature]: Add a pageName object that can be referenced in code
Is there an existing issue for this?
- [X] I have searched the existing issues
Summary
I would like for something like appsmith.url.pageName to exist. I want it to have the exact name with the capitalisation so it can be used in navigate to functions. This would be very usefull for creating back buttons withing the app. I am imagining the this page name could be stored in the url parameter. I know I can hard code this but changing the page name would break things and it would also be useful for other things like showing the title of the page within a text widget.
Why should this be worked on?
Enables to set the page name of the previous page in the url which can then be used on the new page to navigate back to the previous one.
I have managed to do the navigation just by going to the url. But displaying the page name in UI from the url is really annoying. Since you have to split the words by hyphens and capitalise the ones that are capitalised.
I'm currently using this function but it has quite some issues. Only works for 2 word pages and capitalises every word.
get_page_name_from_url() {
const page_name = [appsmith.URL.fullPath.split("/")[5].split("-")[0].charAt(0).toUpperCase() + appsmith.URL.fullPath.split("/")[5].split("-")[0].slice(1), appsmith.URL.fullPath.split("/")[5].split("-")[1].charAt(0).toUpperCase() + appsmith.URL.fullPath.split("/")[5].split("-")[1].slice(1)].join(" ")
return page_name
}
Closing this in favor of #26610