page.getKind()

Retrieve the specific category of the page. This method determines the type of page from a set of predefined categories, providing more granular information about the page’s purpose and functionality.

Syntax

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

TypeScript
1// Get Current Page
2const currentPage = (await webflow.getCurrentPage()) as Page
3
4// Get the page
5const pageKind = await currentPage.getKind()
6console.log(`Page Category: ${pageKind}`)

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadPageSettingsAnyAnyAnyAny

page.getName()

Retrieves the name of the page.

Syntax

1page.getName(): Promise<string>

Returns

Promise<string>

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

Example

TypeScript
1// Get Current Page
2const currentPage = await webflow.getCurrentPage() as Page
3
4// Get page name
5const pageName = await currentPage.getName()
6console.log(pageName)

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadPageSettingsAnyAnyAnyAny

page.setName(name)

Sets the name of the page to the provided value.

Syntax

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

TypeScript
1// Get Current Page
2const currentPage = await webflow.getCurrentPage() as Page
3
4// Set page name
5await currentPage.setName("My New Page")
6console.log(pageName)

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canManagePageSettingsAnyAnyAnyAny

page.getSlug()

Retrieves the slug of the page.

Syntax

1webflow.getSlug(): Promise<string>

Returns

Promise<string>

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

Example

1// Get Current Page
2const currentPage = await webflow.getCurrentPage() as Page
3
4// Get page slug
5const pageSlug = await currentPage.getSlug()
6console.log(pageSlug)

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadPageSettingsAnyAnyAnyAny

page.setSlug(slug)

Sets the slug of the page to the provided value.

Syntax

1webflow.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

1// Get Current Page
2const currentPage = await webflow.getCurrentPage() as Page
3
4// Set page Description
5await currentPage.setSlug(slug)
6const newSlug = await currentPage.getSlug()
7console.log("Slug",newSlug)

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canManagePageSettingsAnyAnyAnyAny

page.getPublishPath()

Retrieves the path that will be used when the page is published.

Syntax

1webflow.getPublishPath(): Promise<null | string>

Returns

Promise<string>

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

Example

TypeScript
1// Get Current Page
2const currentPage = await webflow.getCurrentPage() as Page
3
4// Get page path
5const pagePath = await currentPage.getPublishPath()
6console.log(pagePath)

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadPageSettingsAnyAnyAnyAny

page.getTitle()

Retrieves the title of the page.

Syntax

1webflow.getTitle(): Promise<string>

Returns

Promise<string>

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

Example

TypeScript
1// Get Current Page
2const currentPage = await webflow.getCurrentPage() as Page
3
4// Get page title
5const pageTitle = await currentPage.getTitle()
6console.log(pageTitle)

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadPageSettingsAnyAnyAnyAny

page.setTitle(title)

Sets the title of the page to the provided value.

Syntax

1webflow.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

TypeScript
1// Get Current Page
2const currentPage = await webflow.getCurrentPage() as Page
3
4// Set page Title
5await currentPage.setTitle("My New Title")
6console.log(pageTitle)

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canManagePageSettingsAnyAnyAnyAny

page.getDescription()

Retrieves the current description of the page.

Syntax

1webflow.getDescription(): Promise<string>

Returns

Promise<string>

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

Example

TypeScript
1// Get Current Page
2const currentPage = await webflow.getCurrentPage() as Page
3
4// Get page Description
5const pageDescription = await currentPage.getDescription()
6console.log(pageDescription)

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadPageSettingsAnyAnyAnyAny

page.setDescription(description)

Sets the description of the page to the provided value.

Syntax

1webflow.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

TypeScript
1// Get Current Page
2const currentPage = await webflow.getCurrentPage() as Page
3
4// Set page Description
5await currentPage.setDescription("My New Description")
6console.log(pageDescription)

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canManagePageSettingsAnyAnyAnyAny

page.getCollectionId()

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

Syntax

1page.getCollectionId(): Promise<string>

Returns

Promise<string>

A Promise that resolves to the collection ID

Example

1try {
2 // Get Current Page
3 const currentPage = (await webflow.getCurrentPage()) as Page
4
5 // Get Collection ID if page belongs to a collection
6 const collectionId = await currentPage.getCollectionId()
7 console.log(collectionId)
8} catch (error) {
9 console.error([error.cause.tag, error.message])
10}

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

1page.getCollectionName(): Promise<string>

Returns

Promise<string>

A Promise that resolves to the collection name.

Example

1try{
2 // Get Current Page
3 const currentPage = (await webflow.getCurrentPage()) as Page
4
5 // Get Collection ID if page belongs to a collection
6 const collectionName = await currentPage.getCollectionName()
7 console.log(collectionName)
8 }
9catch (error) {
10 console.error([error.message, error.cause.tag])
11 }

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