The Page
object is part of the Webflow Designer Extension API.
The Page Object represents a page within a Site and provides numerous methods for managing its properties. From setting and retrieving page details to managing SEO and Open Graph settings, the Page Object allows you to control many aspects of a Webflow page.
Methods
Page Information
Get Page Name
getName()
Returns: String
Description: Retrieves the name of the page.
let pageName = myPage.getName();
console.log("Page Name:", pageName);
Set Page Name
setName(name: string)
Parameters
name
:string
- The new name to set for the page.
Description: Sets the name of the page to the provided value.
myPage.setName("New Page Name");
Get Page Title
getTitle()
Returns: String
Description: Retrieves the title of the page.
let pageTitle = myPage.getTitle();
console.log("Page Title:", pageTitle);
Set Page Title
setTitle(title:string)
Parameters:
title
:string
- The new title to set for the page.
Description: Sets the title of the page to the provided value.
myPage.setTitle("New Page Title");
Get Page Description
getDescription()
Returns: string
Description: Sets the title of the page to the provided value.
let pageDescription = myPage.getDescription();
console.log("Page Description:", pageDescription);
Set Page Description
setDescription(description: string)
Parameters
description
:string
- The new description to set for the page.
Description: Sets the description of the page to the provided value.
myPage.setDescription("New Page Description");
Page Drafting Status
Check if Page is in Draft Mode
isDraft()
Returns: boolean
Description: Checks if the page is in draft mode or not.
myPage.setDescription("New Page Description");
let isDraft = myPage.isDraft();
console.log("Is Draft:", isDraft);
Set Draft Mode for Page
setDraft(isDraft: boolean)
Parameters:
isDraft
:boolean
- Set totrue
to mark the page as a draft,false
otherwise.
Description: Sets the draft mode of the page.
myPage.setDraft(true);
Open Graph Metadata
Check if Page Uses Title as Open Graph Title
usesTitleAsOgTitle()
Returns: boolean
Description: Checks if the page uses its title as the Open Graph title.
let useTitleAsOgTitle = myPage.usesTitleAsOgTitle();
console.log("Use Title as OG Title:", useTitleAsOgTitle);
Set Use of Title as Open Graph Title for Page
useTitleAsOgTitle(use: boolean)
Parameters:
use
:boolean
- Set to true to use the page title as the OG title, false otherwise.
Description: Sets whether the page should use its title as the Open Graph (OG) title.
myPage.useTitleAsOgTitle(true);
Get Open Graph Title
getOgTitle()
Returns:string
Description: Retrieves the Open Graph title of the page.
let ogTitle = myPage.getOgTitle();
console.log("OG Title:", ogTitle);
Set Open Graph Title
setOgTitle(title: string)
Parameters:
title
:string
- The new OG title to set for the page.
Description:Sets the Open Graph (OG) title of the page to the provided value.
myPage.setOgTitle("New OG Title");
Check if Page Uses Description as Open Graph Description
usesDescriptionAsOgDescription()
Returns:boolean
Description: Checks if the page uses its description as the Open Graph description.
let ogTitle = myPage.getOgTitle();
let useDescriptionAsOgDescription = myPage.usesDescriptionAsOgDescription();
console.log("Use Description as OG Description:", useDescriptionAsOgDescription);
Set Use of Description as Open Graph Description for Page
useDescriptionAsOgDescription(use: boolean)
Parameters:
use
:boolean
- Set totrue
to use the page description as the OG description,false
otherwise.
Description:Sets whether the page should use its description as the Open Graph (OG) description.
myPage.useDescriptionAsOgDescription(true);
Get Open Graph Description
getOgDescription()
Returns:string
Description: Retrieves the Open Graph (OG) description of the page.
let ogDescription = myPage.getOgDescription();
console.log("OG Description:", ogDescription);
Set Open Graph Description
setOgDescription(description: string)
Parameters:
description
:string
- The new OG description to set for the page.
Description:Sets the Open Graph (OG) description of the page to the provided value.
myPage.setOgDescription("New OG Description");
Get Open Graph Image URL
getOgImage()
Returns:string
Description: Retrieves the URL of the Open Graph (OG) image associated with the page.
let ogImageUrl = myPage.getOgImage();
console.log("OG Image URL:", ogImageUrl);
Set Open Graph Image URL
setOgImage(url: string)
Parameters:
url
:string
- The new URL of the OG image to set for the page.
Description:Sets the URL of the Open Graph (OG) image associated with the page.
myPage.setOgImage("https://example.com/image.jpg");
Search Engine Metadata
Check if Page is Excluded from Search Engine Indexing
isExcludedFromSearch()
Returns:boolean
Description: Checks if the page is excluded from search engine indexing.
let isExcluded = myPage.isExcludedFromSearch();
console.log("Is Excluded from Search Indexing:", isExcluded);
Set Page Exclusion from Search Engine Indexing
excludeFromSearch(shouldExclude: boolean)
Parameters:
shouldExclude
:boolean
- Set totrue
to exclude the page from search engine indexing,false
otherwise.
Description:Sets whether the page should be excluded from search engine indexing.
myPage.excludeFromSearch(true);
Check if Page Uses Title as Search Engine Title
usesTitleAsSearchTitle()
Returns:boolean
Description:Checks if the page uses its title as the search engine title.
let useTitleAsSearchTitle = myPage.usesTitleAsSearchTitle();
console.log("Use Title as Search Title:", useTitleAsSearchTitle);
Set Use of Title as Search Engine Title for Page
useTitleAsSearchTitle(use: boolean)
Parameters:
use
:boolean
- Set totrue
to use the page title as the search engine title,false
otherwise.
Description:Sets whether the page should use its title as the search engine title.
myPage.useTitleAsSearchTitle(true);
Get Search Engine Title
getSearchTitle()
Returns:string
Description:Retrieves the search engine title of the page.
let searchEngineTitle = myPage.getSearchTitle();
console.log("Search Engine Title:", searchEngineTitle);
Set Search Engine Title
setSearchTitle(title: string)
Parameters:
title
:string
- The new search engine title to set for the page.
Description:Sets the search engine title of the page to the provided value.
myPage.setSearchTitle("New Search Engine Title");
Check if Page Uses Page Description as Search Engine Description
usesDescriptionAsSearchDescription()
Returns:boolean
Description:Checks if the page uses its description as the search engine description.
let useDescriptionAsSearchDescription = myPage.usesDescriptionAsSearchDescription();
console.log("Use Description as Search Engine Description:", useDescriptionAsSearchDescription);
Set Page Description as Search Engine Description
useDescriptionAsSearchDescription(use: boolean)
Parameters:
use
:boolean
- Set totrue
to use the page description as the search engine description,false
otherwise.
Description:Sets whether the page should use its description as the search engine description.
myPage.useDescriptionAsSearchDescription(true);
Get Search Engine Description
getSearchDescription()
Returns:string
Description: Retrieves the search engine description of the page.
let searchEngineDescription = myPage.getSearchDescription();
console.log("Search Engine Description:", searchEngineDescription);
Set Search Engine Description
setSearchDescription(description: string)
Parameters:
description
:string
- The new search engine description to set for the page.
Description:Sets the search engine description of the page to the provided value.
myPage.setSearchDescription("New Search Engine Description");
Check if Open Graph Image is used as Search Engine Image
usesOgImageAsSearchImage()
Returns:boolean
Description: Checks if the page uses its Open Graph (OG) image as the search engine image.
let useOgImageAsSearchImage = myPage.usesOgImageAsSearchImage();
console.log("Use OG Image as Search Engine Image:", useOgImageAsSearchImage);
Set Open Graph Image as Search Engine Image
useOgImageAsSearchImage(use: boolean)
Parameters:
use
:boolean
- Set totrue
to use the Open Graph (OG) image as the search engine image,false
otherwise.
Description:Sets whether the page should use its Open Graph (OG) image as the search engine image.
myPage.setSearchDescription("New Search Engine Description");
Get Search Engine Image
getSearchImage()
Returns:string
Description: Retrieves the search engine image URL of the page.
let useOgImageAsSearchImage = myPage.usesOgImageAsSearchImage();
console.log("Use OG Image as Search Engine Image:", useOgImageAsSearchImage);
Set Search Engine Image
setSearchImage(url: string)
Parameters:
url
:string
- The new search engine image URL to set for the page.
Description:Sets the search engine image URL of the page.
myPage.setSearchDescription("New Search Engine Description");
Page Configuration
Check Password-Protection
isPasswordProtected()
Returns:boolean
Description: Checks if the page is password-protected.
let isProtected = myPage.isPasswordProtected();
console.log("Is Password-Protected:", isProtected);
Get Utility Page Key
getUtilityPageKey()
Returns:null | string
Description: Retrieves the utility page key, if available.
let utilityPageKey = myPage.getUtilityPageKey();
console.log("Utility Page Key:", utilityPageKey);
Check if Page is Set as Homepage
isHomepage()
Returns:boolean
Description: Checks if the page is set as the homepage.
let isHomepage = myPage.isHomepage();
console.log("Is Homepage:", isHomepage);
Page Management
Save Page Changes
save()
Returns:Promise<undefined>
Description: Saves any changes made to the page.
myPage.save().then(() => {
console.log("Page changes saved successfully!");
}).catch((error) => {
console.error("Error while saving page changes:", error);
});
Delete Page
destroy()
Returns: undefined
Description: Deletes or removes the page.
myPage.destroy();