For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Resources
Get started
ReferenceGuidesExamplesChangelog
ReferenceGuidesExamplesChangelog
  • Designer API
    • Introduction
    • Getting Started
    • Webflow CLI
    • Error Handling
    • App Modes
  • Elements
    • Creating & Retrieving Elements
    • Element Properties & Methods
    • Element Types & Methods
  • Styles
    • Managing Style Properties
    • Managing Variable Modes
  • Components
  • Variables & Collections
    • Variable Collections
    • Variables
    • Variable Modes
  • Assets
  • Pages & Folders
      • Page information
      • Page settings
        • Get branch ID
        • Get parent page ID
        • List branches
  • Utilities
    • User Events & Notifications
    • App Intents & Connections
  • Additional Resources
    • API Playground
    • FAQs
LogoLogo
Resources
Get started
On this page
  • page.getParentPageId()
  • Syntax
  • Returns
  • Example
  • Designer Ability
Pages & FoldersManaging PagesPage branching

Get parent page ID

Was this page helpful?
Previous

List branches

Next
Built with

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}

Try this example

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadPageSettingsAnyAnyAnyAny