ThisPage or CurrentPageUrl

Hi Team,

Is there anyway to get a ‘ThisPage()’ or ‘getCurrentPageUrl’ or ‘getCurrentPageId’?

I am happy for Coda Formula solutions and Javascript solutions within a code pack?

For a little bit of context I am considering making a pack but the formula needs to know what page it is on. This could be entered by a user but I want to make it as dynamic and user friendly as possible.

PS: I could not see any way to use the ‘context’ object in each pack formula or using the traditional javascript of ‘window.location.href’ to get the current page id.

Suggestions are very welcome!

If you have a control on a page (like a button or a table) you can get the pagename using this

myControl.PageName()

Unfortunately, that wont be the solution in this case.
Still, thats super interesting. Thanks for sharing :smiley:

Could you use the PageName() formula that Coda provides, and then reference, via the doc explorer pack, what the URL or ID of the page is (when having synced in the DocPages sync table)

Thanks for the advice but the user experience wouldn’t be good with this workaround.

I’ll give a little context. I am considering making a pack that displays “PAGE TABS” so people can navigate between sibling pages. It would also have the current page highlighted.

  • In my ideal situation, the pack formula would know what page was calling the formula without needing the user to enter additional detail.
  • An acceptable work would be something the user could copy and paste. E.g. showPageTabs(thisPage()) But this requires a coda formula like thisPage()` which sadly does not exist.
  • I feel like the user experience is not convenient enough if they have to create an object, and then reference that object in my packs formula. A common use case would then be copying and pasting the tabs formula to a new page. But this would result in a bad user experience where the tab strip believed it was on a different page. (Since the formula would be referencing an object on the last page)

Still, thanks for the brainstorming team