Get parent page ID

page.getParentPageId()

Get the ID of the source page that a branch was created from, or null if the page is not a branch.

Use this method together with webflow.switchPage() to navigate from a branch back to the main page.

Syntax

1page.getParentPageId(): Promise<string | null>

Returns

Promise<string | null>

A Promise that resolves to the parent page ID as a string when the page is a branch, or null when the page is not a branch.

Example

1const currentPage = await webflow.getCurrentPage()
2
3const parentPageId = await currentPage.getParentPageId()
4if (parentPageId) {
5 console.log('Branch source page ID:', parentPageId)
6
7 // Navigate back to the main page
8 const allPages = await webflow.getAllPagesAndFolders()
9 const parentPage = allPages.find(p => p.id === parentPageId)
10 if (parentPage) {
11 await webflow.switchPage(parentPage)
12 }
13} else {
14 console.log('This page is not a branch.')
15}

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadPageSettingsAnyAnyAnyAny