Configure lang attribute in AEM Edge Delivery sites

Configure the lang attribute in static HTML when building multilingual sites with AEM Universal Editor and Edge Delivery Services. This approach ensures the HTML element includes the correct language setting for SEO and accessibility before client-side JavaScript runs. To fix this, configure html-lang in metadata so Edge Delivery Services renders the correct lang attribute in the static HTML.

Description description

Environment

  • Adobe Experience Manager as a Cloud Service (AEMaaCS) – Sites
  • Edge Delivery Services
  • Universal Editor

Issue/Symptoms

  • The static HTML output does not include a lang attribute on the HTML element.
  • It becomes difficult to meet SEO and accessibility requirements for multi-country or multi-language sites.

Resolution resolution

To resolve this issue, follow these steps:

  1. Locate the metadata definition file in your Edge Delivery repository. This can be a spreadsheet such as metadata.xlsx or a CSV file, or a JSON sheet exposed as /metadata.json on your .aem.page or .aem.live host.
  2. Add locale-specific mappings to the metadata file and use global patterns in the URL column to match locale-specific paths, for example /it-it/<b> for Italian pages.
  3. For each mapping, specify the appropriate language–region code in an html-lang property that matches your URL structure, such as it-IT for /it-it/.
  4. Commit and push the changes to the branch used by your Edge Delivery Services site.
  5. Republish at least one sample page in each locale from AEM or Universal Editor so the updated metadata is considered.
  6. Open the corresponding Edge Delivery Services URL (.aem.page or .aem.live) for a sample locale page.
  7. Use View Page Source to confirm the HTML element includes the correct lang attribute. . If the correct result appears on Edge Delivery Services but not on the production domain, clear the CDN cache or verify the domain mapping points to the updated branch or host.

### Notes

  • - For most multi-country or multi-language sites, managing html-lang via bulk metadata is recommended for simplicity and robustness. You can achieve more granular control per page by adding an HTML-lang field to individual page metadata within Universal Editor. However, this value must still be surfaced as html-lang in metadata for Edge Delivery Services to render it correctly.
recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f