page.isDraft()

Checks if the page is a draft.

Syntax

1page.isDraft(): Promise<boolean>

Returns

** Promise<boolean>**

A Promise that resolves to a boolean value.

Example

TypeScript
1// Get Current Page
2const currentPage = await webflow.getCurrentPage() as Page
3
4// Check page status
5const isDraft = await currentPage.isDraft()
6
7// Print page status
8if (isDraft) {
9
10 console.log('Page is draft')
11} else {
12 console.log('Page is not a draft')
13}

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadPageSettingsAnyAnyAnyAny

page.setDraft(isDraft)

Sets the draft mode of the page.

Syntax

1page.setDraft(isDraft: boolean): Promise<null>

Parameters

  • isDraft: boolean - Set to true to mark the page as a draft, false otherwise.

Returns

Promise<null>

A Promise that resolves to null.

Example

TypeScript
1// Get Current Page
2const currentPage = await webflow.getCurrentPage() as Page
3
4// Set page as draft
5await currentPage.setDraft(true)
6const isDraft = await currentPage.isDraft()
7
8// Print status
9console.log(isDraft)

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canManagePageSettingsAnyAnyAnyAny

page.isPasswordProtected()

Checks if the page is password-protected.

Syntax

1page.isPasswordProtected(): Promise<boolean>

Returns

Promise<boolean>

A Promise that resolves to a boolean value.

Example

TypeScript
1// Get Current Page
2const currentPage = await webflow.getCurrentPage() as Page
3
4// Check if current page is the homepage
5const isPasswordProtected = await currentPage.isPasswordProtected()
6
7if (isPasswordProtected) {
8 console.log('Current page is PasswordProtected')
9} else {
10 console.log('Current page is not PasswordProtected')
11}

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadPageSettingsAnyAnyAnyAny

page.getUtilityPageKey()

Retrieves the utility page key if available.

Syntax

1page.getUtilityPageKey(): Promise<null | string>

Returns

Promise<null | string>

A Promise that resolves to a string with the value of the utility key, or null if the page is not a utility page.

Example

TypeScript
1// Get Current Page
2const currentPage = await webflow.getCurrentPage() as Page
3
4// Get utily key
5const utilityKey = await currentPage.getUtilityPageKey()
6console.log("Utility Key", utilityKey)

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadPageSettingsAnyAnyAnyAny

page.isHomepage()

Checks if the page is set as the homepage.

Syntax

1page.isHompeage(): Promise<boolean>

Returns

Promise<boolean>

A Promise that resolves to a boolean value.

Example

TypeScript
1// Get Current Page
2const currentPage = await webflow.getCurrentPage() as Page
3
4// Check if current page is the homepage
5const isHomepage = await currentPage.isHomepage()
6
7if (isHomepage) {
8 console.log('Current page is the Homepage')
9} else {
10 console.log('Current page is not the Homepage')
11}

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadPageSettingsAnyAnyAnyAny