page.getKind()
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
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
// Get Current Page
const currentPage = (await webflow.getCurrentPage()) as Page
// Get the page
const pageKind = await currentPage.getKind()
console.log(`Page Category: ${pageKind}`)
Designer Ability
Designer Ability | Locale | Branch | Workflow | Sitemode |
---|---|---|---|---|
canReadPageSettings | Any | Any | Any | Any |
page.getName()
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 Ability | Locale | Branch | Workflow | Sitemode |
---|---|---|---|---|
canReadPageSettings | Any | Any | Any | Any |
page.setName(name)
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 Ability | Locale | Branch | Workflow | Sitemode |
---|---|---|---|---|
canManagePageSettings | Any | Any | Any | Any |
page.getSlug()
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 Ability | Locale | Branch | Workflow | Sitemode |
---|---|---|---|---|
canReadPageSettings | Any | Any | Any | Any |
page.setSlug(slug)
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 Ability | Locale | Branch | Workflow | Sitemode |
---|---|---|---|---|
canManagePageSettings | Any | Any | Any | Any |
page.getPublishPath()
page.getPublishPath()
Retrieves the path that will be used when the page is published.
Syntax
webflow.getPublishPath(): Promise<null | string>
Returns
Promise<string
>
A Promise that resolves to a string with the value of the page path.
Example
// Get Current Page
const currentPage = await webflow.getCurrentPage() as Page
// Get page path
const pagePath = await currentPage.getPublishPath()
console.log(pagePath)
Designer Ability
Designer Ability | Locale | Branch | Workflow | Sitemode |
---|---|---|---|---|
canReadPageSettings | Any | Any | Any | Any |
page.getTitle()
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 Ability | Locale | Branch | Workflow | Sitemode |
---|---|---|---|---|
canReadPageSettings | Any | Any | Any | Any |
page.setTitle(title)
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 Ability | Locale | Branch | Workflow | Sitemode |
---|---|---|---|---|
canManagePageSettings | Any | Any | Any | Any |
page.getDescription()
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 Ability | Locale | Branch | Workflow | Sitemode |
---|---|---|---|---|
canReadPageSettings | Any | Any | Any | Any |
page.setDescription(description)
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 Ability | Locale | Branch | Workflow | Sitemode |
---|---|---|---|---|
canManagePageSettings | Any | Any | Any | Any |
page.getCollectionId()
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.
Tag | Message |
---|---|
ResourceMissing | Missing ${Page.id} |
Designer Ability
Designer Ability | Locale | Branch | Workflow | Sitemode |
---|---|---|---|---|
canReadPageSettings | Any | Any | Any | Any |
page.getCollectionName()
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.
Tag | Message |
---|---|
ResourceMissing | Missing ${Page.id} |
Designer Ability
Designer Ability | Locale | Branch | Workflow | Sitemode |
---|---|---|---|---|
canReadPageSettings | Any | Any | Any | Any |