List branches

page.listBranches()

List all branches that exist for a page.

Each entry in the returned array contains the branch’s page ID and branch ID. Use the page ID with webflow.switchPage() to navigate to a branch.

Syntax

1page.listBranches(): Promise<Array<{pageId: string, branchId: string}>>

Returns

Promise<Array<{pageId: string, branchId: string}>>

A Promise that resolves to an array of objects, one per branch. Each object contains:

PropertyTypeDescription
pageIdstringThe page ID of the branch. Pass this value to webflow.switchPage() to navigate to the branch.
branchIdstringThe branch identifier.

The array is empty when the page has no branches.

Example

1const currentPage = await webflow.getCurrentPage()
2
3const branches = await currentPage.listBranches()
4if (branches.length > 0) {
5 console.log(`Found ${branches.length} branch(es):`)
6 for (const branch of branches) {
7 console.log(` pageId: ${branch.pageId}, branchId: ${branch.branchId}`)
8 }
9
10 // Navigate to the first branch
11 const allPages = await webflow.getAllPagesAndFolders()
12 const branchPage = allPages.find(p => p.id === branches[0].pageId)
13 if (branchPage) {
14 await webflow.switchPage(branchPage)
15 }
16} else {
17 console.log('No branches found for this page.')
18}

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadPageSettingsAnyAnyAnyAny