> For the complete documentation index, see [llms.txt](https://developers.weglot.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.weglot.com/wordpress/use-cases/how-weglot-handles-link-translation-and-exclusions.md).

# How Weglot handles link translation and exclusions

Weglot automatically translates both the **URL** of a link and its **text label**, based on the current language. This page explains the default behavior and how to control each part independently.

### Default behavior

Take this link:

```html
<a id="my-link" href="https://weglot.com" title="Weglot website">this is my link label</a>
```

On the French version of your site, Weglot outputs:

```html
<a id="my-link" href="https://weglot.com/fr/" title="Weglot website">ceci est le label de mon lien</a>
```

* The **label** (`this is my link label`) is translated.
* The **URL** is automatically adapted to include the language code (`/fr/`).

### Excluding a link from translation

If you exclude the link (for example with the `#my-link` selector in your exclusion rules), the **label stays untranslated** — but the **URL is still adapted** to include the language code:

```html
<a id="my-link" href="https://weglot.com/fr/" title="Weglot website">this is my link label</a>
```

This is expected: excluding a block prevents its text from being translated, while link URLs are rewritten by a separate mechanism.

### Keep the URL untranslated but still translate the label

Sometimes you want the opposite: keep the link URL exactly as-is (no language code) while still translating the label. Add the `wg-excluded-link` attribute to the tag:

```html
<a id="my-link" href="https://weglot.com" title="Weglot website" wg-excluded-link>this is my link label</a>
```

Result in French:

```html
<a id="my-link" href="https://weglot.com" title="Weglot website">ceci est le label de mon lien</a>
```

* The URL stays `https://weglot.com` (no `/fr/`).
* The label is still translated.

Use this when a specific URL must stay untouched (an external tracking link, a file, a third-party endpoint…) while still giving your visitors a localized link text.
