# Language functionality and hreflang tag

**URL:** <https://community.hubspot.com/t/language-functionality-and-hreflang-tag/74934>\
**Category:** CMS Development\
**Tags:** enterprise\
**Created:** [February 10, 2023, 9:01am UTC](https://community.hubspot.com/t/language-functionality-and-hreflang-tag/74934 "2023-02-10T09:01:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TomasCarlsson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/tomascarlsson/32/35493_2.png) [@TomasCarlsson](https://community.hubspot.com/u/TomasCarlsson)\
**Post date:** [February 10, 2023, 9:01am UTC](https://community.hubspot.com/t/language-functionality-and-hreflang-tag/74934/1 "2023-02-10T09:01:43Z")

</div>

Hi,

I read on [Multi-language Content - HubSpot docs](https://developers.hubspot.com/docs/cms/features/multi-language-content) that Hubspot default multi-language functionality automatically adds an _hreflang_ tag tag to the pages with a choosen language:

`<link rel="alternate" hreflang="lang_code" href="url_of_page" />`

However, is it possible to add this tag dynamically to the header of a theme if not used the language variation functionality?

Lets say that I have 3 websites (3 different subdomains) called:

[https://english.domain.com](https://english.domain.com)

[https://spanish.domain.com](https://spanish.domain.com)

[https://german.domain.com](https://german.domain.com)

They all use the same shared design theme/templates.

How can I add/code a dynamic hreflang tag for all websites in my shared theme?

The only tag I have right now is:

`<html lang="{{ html_lang }}" {{ html_lang_dir }}>`

but that does not add the hreflang tag.

Thanks

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [February 10, 2023, 11:50pm UTC](https://community.hubspot.com/t/language-functionality-and-hreflang-tag/74934/2 "2023-02-10T23:50:33Z")

</div>

Hi, @TomasCarlsson 👋 Thanks for the question! Hey, @assi @BarryGrennan, do you have any experience here? Or thoughts on how @TomasCarlsson might approach this?

Thank you! — Jaycee

---

<div class="post-metadata">

**Author:** ![mwx\_kk](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/mwx_kk/32/89900_2.png) [@mwx\_kk](https://community.hubspot.com/u/mwx_kk)\
**Post date:** [February 13, 2024, 3:11pm UTC](https://community.hubspot.com/t/language-functionality-and-hreflang-tag/74934/3 "2024-02-13T15:11:44Z")

</div>

Hi @TomasCarlsson ,

you could do something like this:

```lia-code-sample
{% set href_plain = '//' ~ request.domain ~ '/' %}

<link rel="alternate" hreflang="en" href="{{ href_plain }} ~ /en" />
<link rel="alternate" hreflang="es" href="{{ href_plain }} ~ /es" />
<link rel="alternate" hreflang="pt" href="{{ href_plain }} ~ /pt" />

```
