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
      • Create folder
      • Create page
      • Get all pages and folders
      • Get the current page
      • Switch to a page
  • Utilities
    • User Events & Notifications
    • App Intents & Connections
  • Additional Resources
    • API Playground
    • FAQs
LogoLogo
Resources
Get started
On this page
  • webflow.getAllPagesAndFolders()
  • Syntax
  • Returns
  • Example
  • Branch pages
  • Designer Ability
Pages & FoldersCreating & Retrieving Pages and Folders

Get all pages and folders

Was this page helpful?
Previous

Get the current page

Next
Built with

webflow.getAllPagesAndFolders()

Retrieves all pages and folders in the current site.

Syntax

1webflow.getAllPagesAndFolders(): Promise<Array<Page | Folder>>

Returns

Promise<Array<Folder | Page>>

A Promise that resolves to an array of page and/or folder objects.

Example

1// Get all pages and folders
2const pagesAndFolders = await webflow.getAllPagesAndFolders()
3
4// Print Page Details
5const pages = pagesAndFolders?.filter(i => i.type === "Page")
6await Promise.all(pages.map(async page => {
7
8 const pageName = await page.getName()
9 console.log(`Page: ${pageName}`)
10
11}))
12
13const folders = pagesAndFolders?.filter(i => i.type === "PageFolder")
14await Promise.all(folders.map(async folder => {
15
16 const folderName = await folder.getName()
17 console.log(`Folder: ${folderName}`)
18
19}))

Try this example

Branch pages

Results include branch pages, because branches are pages internally. Use page.getBranchId() to distinguish branch pages from main pages, and page.listBranches() to discover all branches for a specific page.

Designer Ability

Designer AbilityLocaleBranchWorkflowSitemode
canReadPageSettingsAnyAnyAnyAny