# URL Localization

**URL:** https://forum.builder.io/t/url-localization/4119
**Category:** Technical Questions
**Tags:** nextjs
**Created:** [August 30, 2023, 3:03pm UTC](https://forum.builder.io/t/url-localization/4119 "2023-08-30T15:03:25Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jjablonski](https://avatars.discourse-cdn.com/v4/letter/j/e19b73/32.png) [@jjablonski](https://forum.builder.io/u/jjablonski)
#### Post date: [August 30, 2023, 3:03pm UTC](https://forum.builder.io/t/url-localization/4119/1 "2023-08-30T15:03:25Z")

</div>

Hi, we want to implement URL path localization along with the content of the site. For example, the English site would have `/about` and the Swedish site would have `/sv/om` (the `/sv` part is handled automatically by Next.js i18n, so the URL path should be just `/om`).

We already have the sites localized with field-level localization, and it works great. However, I can’t figure out the best way to add localization to URL paths as well.

### Questions

1. Is there a built-in solution or an example for implementing localization for the `urlPath` targeting?

2. What’s the recommended way to add `<link rel="alternate" hreflang="sv" href="https://example/sv/om" />` to the page?

3. (BONUS) What is the best way to map to a specific `page` model entry instead of a raw URL? I want to avoid situations where the `urlPath` changes, but the link (as a string) on another page stays the same, pointing to a non-existing site. This becomes more problematic when a single page has multiple URLs. How can I maintain this effectively?

### Context

I know that there is an option to add multiple `urlPath` for each site, which is helpful but doesn’t solve all the issues. We need to somehow know that the `/om` path is for the `sv` locale.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/builder/original/2X/e/e5417f4b530ca81a0bdffcf83f20cdf7e9389e1b.png)

I can’t see the option to localize targeting attributes, which might have been helpful in this scenario.

Regarding hreflang tags, I thought about creating a list in page fields, but I can’t find a way to connect it with `urlPaths`. It would be ideal if these tags could be automatically created from `urlPaths`.

Any help, ideas, and examples would be greatly appreciated!

---

<div class="post-metadata">

### Author: ![manish-sharma](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@manish-sharma](https://forum.builder.io/u/manish-sharma)
#### Post date: [August 31, 2023, 12:58pm UTC](https://forum.builder.io/t/url-localization/4119/2 "2023-08-31T12:58:52Z")

</div>

Hello @jjablonski,

1. Targeting attributes like `urlPath` cannot be localized, it is only for model fields and component inputs.

2. If you are looking to add “rel” and “hreflang” to the urlPath directly that may not be possible, however, you can add them to page links

In the builder editor, you can add element attributes like “rel”, “hreflang” using **HTML Attributes** option from the style tab

 ![Screenshot 2023-08-31 at 5.43.26 PM](https://us1.discourse-cdn.com/flex020/uploads/builder/original/2X/b/b2dc6304b61c667d95db3d4fc155c5122707a6d3.png)

Also you can refer to our doc [Dynamic Preview URL](https://www.builder.io/c/docs/dynamic-preview-urls) that could possibly give you alternate solutions.

1. You can possibly use relative URLs or Instead of hardcoding links in your content, use dynamic link generation based on the current state of your page model entries. This way, the links will always point to the correct URLs regardless of any changes.

Let us know if you have any other questions. Thank you!

---

<div class="post-metadata">

### Author: ![hfrid](https://avatars.discourse-cdn.com/v4/letter/h/4af34b/32.png) [@hfrid](https://forum.builder.io/u/hfrid)
#### Post date: [December 27, 2023, 8:24am UTC](https://forum.builder.io/t/url-localization/4119/3 "2023-12-27T08:24:52Z")

</div>

I too am wondering what the recommended best practice is to implement HREFLANG in [Builder.io](http://Builder.io)? For page-level localization, would it not be great if the tags are added automatically upon creating a localized copy of a page? Some option to tag one of the pages as x-default.
