APIsChangelog
Log In

Open Graph metadata

page.usesTitleAsOpenGraphTitle()

Checks if the page uses the page title as the Open Graph title.

Syntax

page.usesTitleAsOpenGraphTitle(): Promise<boolean>

Returns

Promise<boolean>

A Promise that resolves to a boolean value.

Example

// Get Current Page
const currentPage = await webflow.getCurrentPage() as Page

// Check if page is using the Title as the Open Graph title
const isOpenGraphTitle = await currentPage.usesTitleAsOpenGraphTitle()

// Print results
if (isOpenGraphTitle) {

  console.log('Page uses Title as Open Graph Title')
} else {
  console.log('This page has a custom Open Graph Title')
}

page.useTitleAsOpenGraphTitle(use)

Indicate whether the page should use its title as the Open Graph (OG) title.

Syntax

page.useTitleAsOpenGraphTitle(use: boolean): Promise<null>

Parameters

  • use: boolean - Set to true to use the page title as the OG title, false otherwise.

Returns

Promise<null>

A Promise that returns to null

Example

// Get Current Page
const currentPage = await webflow.getCurrentPage() as Page

// Set page title as open graph title
await currentPage.useTitleAsOpenGraphTitle(true)
const title = await currentPage.getOpenGraphTitle()
console.log(title)

page.getOpenGraphTitle()

Retrieves the Open Graph title of the page.

Syntax

page.getOpenGraphTitle(): Promise<string>

Returns

Promise<string>

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

Example


// Get Current Page
const currentPage = await webflow.getCurrentPage() as Page

// Get Open Graph Title
const openGraphTitle = await currentPage.getOpenGraphTitle()
console.log("Open Graph Title", openGraphTitle)

page.setOpenGraphTitle(title)

Sets the Open Graph (OG) title of the page to the provided value.

Syntax

page.setOpenGraphTitle(title: string): Promise<null>

Parameters

  • title: string - The new OG title to set for the page.

Returns

Promise<null>

A Promise that returns to null.

Example

// Get Current Page
const currentPage = await webflow.getCurrentPage() as Page

// Set Open Graph Title
await currentPage.setOpenGraphTitle("My New Title")

// Print results
const openGraphTitle = await currentPage.getOpenGraphTitle()
console.log("Open Graph Title", openGraphTitle)

page.usesDescriptionAsOpenGraphDescription()

Checks if the page uses its description as the Open Graph description.

Syntax

page.usesDescriptionAsOpenGraphDescription(): Promise<boolean>

Returns

Promise<boolean>

A Promise that resolves to a boolean value.

Example

// Get Current Page
const currentPage = await webflow.getCurrentPage() as Page

// Check page status
const isOpenGraphDescription = await currentPage.usesDescriptionAsOpenGraphDescription()

// Print page status
if (isOpenGraphDescription) {

  console.log('Page uses Page Description as Open Graph Description')
} else {
  console.log('This page has a custom Open Graph Description')
}

page.useDescriptionAsOgDescription(use)

Indicate whether the page should use its description as the Open Graph description.

Syntax

page.useDescriptionAsOgDescription(use: boolean): Promise<null>

Parameters

  • use: boolean - Set to true to use the page description as the OG description, false otherwise.

Returns

Promise<null>

A Promise that resolves to null when the Open Graph description is set.

Example

// Get Current Page
const currentPage = await webflow.getCurrentPage() as Page

// Set page description open graph description
await currentPage.useDescriptionAsOpenGraphDescription(true)
const description = await currentPage.getOpenGraphDescription()
console.log(description)

page.getOpenGraphDescription()

Retrieves the Open Graph description of the page.

Syntax

page.getOpenGraphDescription(): Promise<string>

Returns

Promise<string>

A Promise that resolves to a string value of the Open Graph description.

Example

// Get Current Page
const currentPage = await webflow.getCurrentPage() as Page

// Get Open Graph Description
const openGraphDescription = await currentPage.getOpenGraphDescription()
console.log("Open Graph Description", openGraphDescription)

page.setOpenGraphDescription(description)

Sets the page's Open Graph description to the provided value.

Syntax

page.setOpenGraphDescription(description: string): Promise<null>

Parameters

  • description: string - The new OG description to set for the page.

Returns

Promise<null>

A Promise that resolves to null when the Open Graph description is set.

Example

// Get Current Page
const currentPage = await webflow.getCurrentPage() as Page

// Set Open Graph Description
await currentPage.setOpenGraphDescription(description)

// Print results
const openGraphDescription = await currentPage.getOpenGraphDescription()
console.log("Open Graph Description", openGraphDescription)


page.getOpenGraphImage()

Retrieves the URL of the Open Graph image associated with the page.

Syntax

page.getOpenGraphImage(): Promise<string>

Returns

Promise<string>

A Promise that resolves to a string with the URL of the Open Graph image.

Example

// Get Current Page
const currentPage = await webflow.getCurrentPage() as Page

//  Get Open Graph image and Print Details
const openGraphImage = await currentPage.getOpenGraphImage()
console.log(openGraphImage)

page.setOpenGraphImage(url)

Sets the URL of the Open Graph image associated with the page.

Syntax

page.setOpenGraphImage(url: string): Promise<null>

Parameters

  • url: string - The new URL of the Open Graph image to set for the page.

Returns

Promise<null>

A Promise that resolves to null when the Open Graph image is set.

Example

// Get Current Page
const currentPage = await webflow.getCurrentPage() as Page

//  Set open graph image and print details
await currentPage.setOpenGraphImage("example.com/image.jpg")
const openGraphImage = currentPage.getOpenGraphImage()
console.log(openGraphImage)