folder.getParent()

Get parent folder of selected folder.

Syntax

1folder.getParent(): Promise<null | Folder>

Returns

Promise<null | Folder>

A Promise that resolves to a Folder object if a parent exists, or null if no parent is found.

Example

TypeScript
1// Get all Pages and folders
2const pagesAndFolders = await webflow.getAllPagesAndFolders()
3
4for (let folder of pagesAndFolders) {
5
6 const childName = await folder.getName()
7 const parent = await folder.getParent()
8 const parentName = await parent?.getName()
9 console.log(`Folder: ${childName}`, `Parent: ${parentName}`)
10}

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadPageSettingsAnyAnyAnyAny