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 attributeon 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:
- Locate the metadata definition file in your Edge Delivery repository. This can be a spreadsheet such as
metadata.xlsxor a CSV file, or a JSON sheet exposed as/metadata.jsonon your.aem.pageor.aem.livehost. - 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. - For each mapping, specify the appropriate language–region code in an
html-langproperty that matches your URL structure, such asit-ITfor/it-it/. - Commit and push the changes to the branch used by your Edge Delivery Services site.
- Republish at least one sample page in each locale from AEM or Universal Editor so the updated metadata is considered.
- Open the corresponding Edge Delivery Services URL (
.aem.pageor.aem.live) for a sample locale page. - 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-langvia 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 ashtml-langin metadata for Edge Delivery Services to render it correctly.
recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f