Localizing pages
Webflow’s Data API enables you to localize DOM content and metadata across different locales. Localizing pages requires two main steps:
- Retrieve data from the primary locale
- Update data in the secondary locale
Workflows
There are two main workflows for localizing pages:
Localize text content in a secondary locale
Localize page titles, SEO descriptions, and Open Graph descriptions in a secondary locale
DOM Content
The DOM content endpoints enable you to localize text for any secondary locale. The process involves the following steps:
Fetch primary locale content
Use the Get page content endpoint to retrieve the page’s DOM structure and default content.
Translate content
Traverse the nodes
array in the response to identify and translate all text content.
Update secondary locale content
Use the localeId
parameter in your request to the Update Page Content endpoint to apply the localized content.
Retrieve page content
Start by getting the content structure for a given static page. You’ll need the pageId
, which you can find by listing all pages for a site using the list pages endpoint. Once you have the pageId
, you can use the get page content endpoint to retrieve the content structure for the page.
Request
Note: This API will only return content for static pages. Dynamic pages, like CMS Collection templates will return an empty response.
Response
The response contains a nodes
array with the page’s static content. Each node includes a type
property that defines its content type.
The unique identifier for the page
The list of nodes that represent the static content of the page
The pagination information for the response
The date the page was most recently updated
By default, if you don’t include a localeId
in your request, the response will return content from the primary locale.
Nodes
The page content endpoint returns a list of nodes that represent static text and images available for localization. Note: this endpoint doesn’t return the entire DOM structure of the page, but only the static content available for localization.
Node types
Different node types represent different kinds of content, each with its own structure and properties.
Node properties
Each node type has a specific structure and properties that define the content it contains. However, all nodes will have the following properties:
Node UUID
The type of the node.
Acceptable values: text
, image
, text-input
, select
, submit-button
, search-button
, component-instance
The custom attributes of the node. These are typically used to store custom data on the node like aria-labels
for accessibility or data-w-id
.
Node properties by type
Each node type has a unique structure for accessing page content. For example, a text
node contains a text
object, which typically includes html
and text
properties. These properties provide context for strings that can be localized. The tabs below detail the specific properties for each node type.
Text
Image
Text Input
Select
Submit Button
Component Instance
Node UUID
The type of the node. text
The text content of the node
+ Show 2 properties
The HTML content of the node
The text content of the node
The custom attributes of the node
Nested HTML tags
The text.html
property may contain nested HTML tags with data-w-id
attributes (e.g., data-w-id="some-unique-identifier"
). Retain these identifiers when updating page content in secondary locales to preserve custom attributes and links on inner HTML elements.
Update page content
Once you’ve identified and translated the content you want to localize, you can update it using the update page content endpoint. You’ll need to pass in the localeId
of the secondary locale you want to update as a query parameter, and a list of nodes
to update in the request body.
Each node should have the nodeId
of the node you want to update, and the node value you want to update. The node value will vary depending on the node type.
Updating text nodes
When updating text nodes, pass the text
property with the translated text, structured as the HTML content received from the Get Page Content endpoint. The HTML tag structure must remain identical to the Get Content endpoint’s response.
Updating images isn't supported by the API
Currently, updating images isn’t supported by the API. To update images, you’ll need to update the image asset in the Webflow designer.
Metadata
The metadata endpoints enable you to localize SEO and Open Graph content for any secondary locale. The process involves the following steps:
Update secondary locale metadata
Use the Update page metadata endpoint to update the metadata for the secondary locale.
Retrieve page metadata
First, retrieve the page metadata for the primary locale using the Get page metadata endpoint.
This endpoint will return metadata shown above for the primary locale. The response includes both internal and external information about your webflow page, including unique identifiers, draft information, and publish times.
For a full list of information returned see the Get page metadata page in the API reference.
Update page metadata
To update metadata for a secondary locale, translate the properties listed below and include them in the request body when calling the Update page metadata endpoint.
Request
Slug localization is only available with specific Webflow plans:
- Localize Advanced add-on
- Enterprise Localization
Complete localization workflow
Here’s a complete example that demonstrates the full page localization process for static content (not including components):
FAQ
Do I need to update all nodes when updating page content?
No, you only need to include the nodes you want to update in the request body. If you don’t include a node in the Update Page Content request body, that element will inherit the content from the primary locale.
What happens if an error occurs when updating page content?
If an error occurs when attempting to update a node on a page, the request may still return a 200 status code, but you may want to check the response body for the errors
array to see if any errors surfaced.
Why can't I update page content in the primary locale with APIs?
Because the primary locale is the source of truth for content, changes must be initiated through the Webflow canvas at this time.
Why am I getting component-instance types in the Get Page Content response?
Component instances are included in the Get Page Content API response to provide a more wholistic view of the content on a page.
When getting page content for the primary locale, all component instances are included in the response. When getting page content for a secondary locale, only component instances with property overrides are included in the response.
Learn more in the Components and properties guide.
After making updates to page content, why isnt' the content reflecting in the Webflow canvas?
When making updates to your site via Data APIs, you may need to refresh the page in order to see the changes reflect in the Webflow canvas.