Anchor Link to homepage

Hi,
Sorry to post it here. Been trying to google it but everything just won’t work.
I have anchor button on my header which links to a section down my homepage.

<a href="https://mysite.com#mysection">to section</a>

This works ONLY when I’m at the homepage.
I have tried all solutions I’ve come across while searching like the following:

<a href="https://mysite.com/index.html#mysection">to section</a>
<a href="https://mysite.com/home#mysection">to section</a>
<a href="https://mysite.com/en/home#mysection">to section</a>

All doesn’t work. Could someone please help me with this?

Thank you.

Is that a multi language site? And if so, do you want to link to the default language or to the current language?

Yes, it is a multi language site. And yes, I would like to link to the current language.

<a href="<?= $site->homePage()->url().'#mysection' ?>" rel="home"><?= $site->title()->html() ?></a>
1 Like

Thank you.
Turned out my first link was correct. It was the javascript for smooth scrolling that was preventing the jump.
Still your link is the answer for my multi language site.