APIsChangelog
Log In

Page settings

page.isDraft()

Checks if the page is a draft.

Syntax

page.isDraft(): Promise<boolean>

Returns

Promise<boolean>

A Promise that resolves to a boolean value.

Example

// Get Current Page
const currentPage = await webflow.getCurrentPage() as Page

// Check page status
const isDraft = await currentPage.isDraft()

// Print page status
if (isDraft) {

  console.log('Page is draft')
} else {
  console.log('Page is not a draft')
}

page.setDraft(isDraft)

Sets the draft mode of the page.

Syntax

page.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

// Get Current Page
const currentPage = await webflow.getCurrentPage() as Page

// Set page as draft
await currentPage.setDraft(true)
const isDraft = await currentPage.isDraft()

// Print status
console.log(isDraft)

page.isPasswordProtected()

Checks if the page is password-protected.

Syntax

page.isPasswordProtected(): Promise<boolean>

Returns

Promise<boolean>

A Promise that resolves to a boolean value.

Example

// Get Current Page
const currentPage = await webflow.getCurrentPage() as Page

// Check if current page is the homepage
const isPasswordProtected = await currentPage.isPasswordProtected()

if (isPasswordProtected) {
  console.log('Current page is PasswordProtected')
} else {
  console.log('Current page is not PasswordProtected')
}

page.getUtilityPageKey()

Retrieves the utility page key if available.

Syntax

page.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

// Get Current Page
const currentPage = await webflow.getCurrentPage() as Page

// Get utily key
const utilityKey = await currentPage.getUtilityPageKey()
console.log("Utility Key", utilityKey)

page.isHomepage()

Checks if the page is set as the homepage.

Syntax

page.isHompeage(): Promise<boolean>

Returns

Promise<boolean>

A Promise that resolves to a boolean value.

Example

// Get Current Page
const currentPage = await webflow.getCurrentPage() as Page

// Check if current page is the homepage
const isHomepage = await currentPage.isHomepage()

if (isHomepage) {
  console.log('Current page is the Homepage')
} else {
  console.log('Current page is not the Homepage')
}