For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Resources
Get started
ReferenceGuidesExamplesChangelog
ReferenceGuidesExamplesChangelog
  • Designer API
    • Introduction
    • Getting Started
    • Webflow CLI
    • Error Handling
    • App Modes
  • Elements
    • Creating & Retrieving Elements
    • Element Properties & Methods
    • Element Types & Methods
  • Styles
    • Managing Style Properties
    • Managing Variable Modes
  • Components
  • Variables & Collections
    • Variable Collections
    • Variables
    • Variable Modes
  • Assets
  • Pages & Folders
      • Page information
        • Get page name
        • Set page name
        • Get page title
        • Set page title
        • Get page slug
        • Set page slug
        • Get page description
        • Set page description
        • Get publish path
        • Get page category
        • Get utility page key
        • Get collection ID
        • Get collection name
      • Page settings
  • Utilities
    • User Events & Notifications
    • App Intents & Connections
  • Additional Resources
    • API Playground
    • FAQs
LogoLogo
Resources
Get started
On this page
  • page.getCollectionName()
Pages & FoldersManaging PagesPage information

Get collection name from a CMS page

Was this page helpful?
Previous

Check if page is draft

Next
Built with

page.getCollectionName()

Get the name of the collection that generated the collection-generated page.

Syntax

1page.getCollectionName(): Promise<string>

Returns

Promise<string>

A promise that resolves to the name of the collection that generated the page.

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 }

Try this example

Error Handling

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

TagMessage
ResourceMissingMissing ${page.id}

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadPageSettingsAnyAnyAnyAny