Site to Site link - Domain issue

In a custom navigation I’m trying to link from one page to another. the page tree looks like:

  • home (id 1, www.example.com)
    – de_DE
    — page 1 (pagetype link)
    — page 2 (pagetype link)
    — page 3 (pagetype link)

  • site1 (site1.example.com)
    – de_DE
    — page 1
    — page 2
    — page 3

  • site2 (site2.example.com)
    – de_DE
    — page 1
    — page 2
    — page 3

If I set a link (in Pimcore backend) from “/de_DE/page1” to “/site1/de_DE/page1” the link generated looks like “www.example.com/site1/de_DE/page1” but I expect to get “site1.example.com/de_DE/page1”.

How can I achieve the link to be generated with correct subdomain?

I solved this by using DocumentUrlGenerator!

There is a plugin you might find useful https://github.com/dachcom-digital/pimcore-i18n
With this you are able to setup zones, update your links etc