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

page.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

const currentPage = await webflow.getCurrentPage()
const parentPageId = await currentPage.getParentPageId()
if (parentPageId) {
console.log('Branch source page ID:', parentPageId)
// Navigate back to the main page
const allPages = await webflow.getAllPagesAndFolders()
const parentPage = allPages.find(p => p.id === parentPageId)
if (parentPage) {
await webflow.switchPage(parentPage)
}
} else {
console.log('This page is not a branch.')
}

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadPageSettingsAnyAnyAnyAny