Get folder of an Asset

Asset.getParent()

Gets the folder of the current Asset in the Webflow Designer

Syntax

1Asset.getParent(): Promise<AssetFolder | null>

Returns

AssetFolder | null

A Promise that resolves to the parent Asset folder, or null if a parent folder does not exist for the Asset.

Example

1// Get all Assets
2const assets = await webflow.getAllAssets()
3const asset = assets[0]
4
5const folder = await asset.getParent()
6
7if (folder) {
8 console.log(folder)
9} else {
10 console.log("A parent folder does not exist for this asset")
11}

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canAccessAssetsAnyAnyAnyAny