APIsChangelog
Log In

Page information

page.getKind()

Retrieve the “kind” of the current page in the Webflow Designer. This API provides an easy way to determine the type of page, which can be one of several predefined types.

Syntax

page.getKind(): Promise<string>

Returns

Promise<string>

A promise that resolves to a string indicating the kind of the current page. The possible values are:

  • static
  • ecommerce
  • cms
  • userSystems
  • utility
  • staticTemplate

Example

try {
    const page = await webflow.getCurrentPage();
    const kind = await page.getKind();
    console.log(kind); // Outputs: 'static', 'ecommerce', 'cms', 'userSystems', 'utility', or 'staticTemplate'
  } catch (error) {
    console.error('Error retrieving page kind:', error);
  }

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadPageSettingsAnyAnyAnyAny

page.getName()

Retrieves the name of the page.

Syntax

page.getName(): Promise<string>

Returns

Promise<string>

A Promise that resolves to a string with the page name.

Example

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

// Get page name
const pageName = await currentPage.getName()
console.log(pageName)

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadPageSettingsAnyAnyAnyAny

page.setName(name)

Sets the name of the page to the provided value.

Syntax

page.getName(name: string): Promise<null>

Parameters

  • name:string - The new name to set for the page.

Returns

Promise<null>

A Promise that resolves to null when the page name is set.

Example

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

// Set page name
await currentPage.setName("My New Page")
console.log(pageName)

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canManagePageSettingsAnyAnyAnyAny

page.getSlug()

Retrieves the slug of the page.

Syntax

webflow.getSlug(): Promise<string>

Returns

Promise<string>

A Promise that resolves to a string with the page slug.

Example

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

// Get page slug
const pageSlug = await currentPage.getSlug()
console.log(pageSlug)

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadPageSettingsAnyAnyAnyAny

page.setSlug(slug)

Sets the slug of the page to the provided value.

Syntax

webflow.setSlug(slug: string): Promise<null>

Parameters

  • slug:string - The new name to set for the page.

Returns

Promise<null>

A Promise that resolves to null when the page slug is set.

Example

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

// Set page Description
await currentPage.setSlug(slug)
const newSlug = await currentPage.getSlug()
console.log("Slug",newSlug)

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canManagePageSettingsAnyAnyAnyAny

page.getTitle()

Retrieves the title of the page.

Syntax

webflow.getTitle(): Promise<string>

Returns

Promise<string>

A Promise that resolves to a string with the value of the page title.

Example

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

// Get page title
const pageTitle = await currentPage.getTitle()
console.log(pageTitle)

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadPageSettingsAnyAnyAnyAny

page.setTitle(title)

Sets the title of the page to the provided value.

Syntax

webflow.setTitle(title: string): Promise<null>

Parameters

  • title: string - The new title to set for the page.

Returns

Promise<null>

A Promise that resolves to null when the page title has been set.

Example

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

// Set page Title
await currentPage.setTitle("My New Title")
console.log(pageTitle)

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canManagePageSettingsAnyAnyAnyAny

page.getDescription()

Retrieves the current description of the page.

Syntax

webflow.getDescription(): Promise<string>

Returns

Promise<string>

A Promise that resolves to a string containing the page description.

Example

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

// Get page Description
const pageDescription = await currentPage.getDescription()
console.log(pageDescription)

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadPageSettingsAnyAnyAnyAny

page.setDescription(description)

Sets the description of the page to the provided value.

Syntax

webflow.setDescription(description: string): Promise<null>

Parameters

  • description: string - The new description to set for the page.

Returns

Promise<null>

A Promise that resolves to null when the page description has been set.

Example

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

// Set page Description
await currentPage.setDescription("My New Description")
console.log(pageDescription)

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canManagePageSettingsAnyAnyAnyAny

page.getCollectionId()

Get the collection ID from a page that is automatically generated from a collection.

Syntax

page.getCollectionId(): Promise<string>

Returns

Promise<string>

A Promise that resolves to the collection ID

Example

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

  // Get Collection ID if page belongs to a collection
  const collectionId = await currentPage.getCollectionId()
  console.log(collectionId)
} catch (error) {
  console.error([error.cause.tag, error.message])
}

Errors

If the method fails to find a collection, the method will return an error with the following cause and message.

TagMessage
ResourceMissingMissing ${Page.id}

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadPageSettingsAnyAnyAnyAny

page.getCollectionName()

Get the collection name from a page that is automatically generated from a collection.

Syntax

page.getCollectionName(): Promise<string>

Returns

Promise<string>

A Promise that resolves to the collection name.

Example

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

    // Get Collection ID if page belongs to a collection
    const collectionName = await currentPage.getCollectionName()
    console.log(collectionName)
    }
catch (error) {
      console.error([error.message, error.cause.tag])
    }

Errors

If the method fails to find a collection, the method will return an error with the following cause and message.

TagMessage
ResourceMissingMissing ${Page.id}

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadPageSettingsAnyAnyAnyAny