Hreflang dynamic data

Hello, will this work if i set up Hreflang for my site with dynamic data/slug?

< link rel=“alternate” hreflang=“pl” href=“https://wytwornia-zieleni.pl/${page->get(‘data’)->get(‘slug’)}” />

< link rel=“alternate” hreflang=“en” href=“https://wytwornia-zieleni.pl/en/${page->get(‘data’)->get(‘slug’)}” />

< link rel=“alternate” hreflang=“x-default” href=“https://wytwornia-zieleni.pl/${page->get(‘data’)->get(‘slug’)}” />

Thanks for halp :wink:

EDIT 1 it didnt work so i had to make it as a regular- and back to my question, gow can i make hreflang dynamic for my sites?(Ahrefs are showing a lot of problem according to lack of this feature)

This attribute hreflang goes to links inside of language switcher?

No, i just ask gpt how to deal with it, he wrote lines of code and put it in < head> of my site. Should I put it somewhere else?

Ahrefs shows all my sites have the same hreflang so I wanted do make them dynamic.

Okay, this should be handled by us. We will work on it.

@dejan
So basically in head of each page, if page has translated versions, we need to add link rel=“alternate” meta tag.

Thank you a lot for the info👌