---
title: "Enable or disable language codes in sitemap URLs"
slug: "enable-or-disable-language-codes-in-sitemap-urls-1188149"
abstract: "Learn how to configure your sitemap to embed language codes for URLs."
---
# Enable or disable language codes in sitemap URLs

If your pages exist in different languages, consider whether you want the URLs written to the sitemap to contain language codes. Adding language codes helps the search engines determine the language of a page. This means that internet users are more likely to find relevant content in their preferred language.

> [!note]
> You configure language embedding for each site.

You can configure this feature in the following ways:

- *Default* - pages in all languages, except for the default language, get a language code.
- *Always* - pages in all languages get a language code.
- *Never* - regardless of the language, no page gets a language code.

To enable or disable language codes in the sitemap:

1. Open the `Sitecore.XA.Foundation.Multisite.config` file. The path to the directory on the server might look as follows: `\App_Config\Modules\SXA\Foundation\`.
2. Go to the `providers` element inside the `linkManager` element.
3. Add two custom link providers, one for *always* and one for *never* as in the following example: `lpCustomAlways` and `lpCustomNever`.

    > [!note]
    > Adding both types is only relevant if you need to configure your sitemaps differently.

4. For `lpCustomAlways`, set the `languageEmbedding` attribute to `always`.
5. For `lpCustomNever`, set the `languageEmbedding` attribute to `never`.

    Code example:

    ```xml
    <providers>
        <add name="switchableLinkProvider" type="Sitecore.XA.Foundation.Multisite.LinkManagers.SwitchableLinkProvider, Sitecore.XA.Foundation.Multisite"/>
        <add name="localizedProvider" type="Sitecore.XA.Foundation.Multisite.LinkManagers.LocalizableLinkProvider, Sitecore.XA.Foundation.Multisite" cacheExpiration="5" addAspxExtension="false" alwaysIncludeServerUrl="false" encodeNames="true" languageEmbedding="never" languageLocation="filePath" shortenUrls="true" useDisplayName="false"/>
        <add name="lpCustomAlways" type="Sitecore.XA.Foundation.Multisite.LinkManagers.LocalizableLinkProvider, Sitecore.XA.Foundation.Multisite" cacheExpiration="5" addAspxExtension="false" alwaysIncludeServerUrl="false" encodeNames="true" languageEmbedding="always" languageLocation="filePath" shortenUrls="true" useDisplayName="false"/>
        <add name="lpCustomNever" type="Sitecore.XA.Foundation.Multisite.LinkManagers.LocalizableLinkProvider, Sitecore.XA.Foundation.Multisite" cacheExpiration="5" addAspxExtension="false" alwaysIncludeServerUrl="false" encodeNames="true" languageEmbedding="never" languageLocation="filePath" shortenUrls="true" useDisplayName="false"/>
    </providers>
    ```

6. In the Content Editor, navigate to *sitecore/Content/\[site collection\]/\[site\]/Settings* and click the *Sitemap* item.
7. In the **URL options** section, in the **Link provider name** field, do one of the following:
    - To use the *default* setting, leave the field empty.
    - To enable language embedding for all languages, enter the name of the custom link provider, where *languageEmbedding* equals `always`, for example, `lpCustomAlways`.

        ![Specify the custom link provider in the Content Editor](https://doc.sitecore.com/api/markdown-image/xp/en/developers/sxa/105/sitecore-experience-accelerator/images/ce-sitemap-urloptions.png)

    - To disable language embedding for all languages, enter the name of the custom link provider, where *languageEmbedding* equals `never`, for example, `lpCustomNever`.
8. To test that language embedding has been configured correctly, publish the site and view the sitemap.

> [!note]
> Language embedding set as described here is overruled by the language embedding configuration selected in the [site settings](https://doc.sitecore.com/xmc/en/users/xm-cloud/en/manage-sites.html#UUID-573cc3fc-ab88-ce55-c2c1-73acef232445_section-idm234507300031205).