I have a one-page site that uses anchor links for navigation, with a menu snippet that is used in both the Dutch and English version. The Dutch website is just domain.com/, whereas the English version is at domain.com/en/. So the anchor links are domain.com/#anchor-link and domain.com/en/#anchor-link. My question is: how can I set up the menu links to behave properly in this setup?
Ah, sorry, I should have added: it does work fine without the conditional, but the point is that the link should be either just the #anchor-link, or en/#anchor-link. Hence the if-statement.
But if you add “en/#anchor” to domain.com/en, you will end up on the error page …, so where’s the point? Nevertheless, the syntax to achieve that would be:
But that works perfectly alright and I don’t see why that should be any different, sorry. Maybe I just don’t understand what exactly it is that you want to achieve … but I don’t see any need for any language specific implementation or what that should be.
Haha, I suppose I haven’t been clear enough, sorry. http://cool-house.nl/en/ works, and the anchor links there work, but say you’re on the English-language error page. There, the anchor links in the menu won’t work. So ideally I would like to re-do the anchor links so that they would work everywhere. So I thought I could just add /en/ in front of them if the current language is English.
Now I’m with you, but that’s a problem that is not language specific but you’ll have that on every one pager with additional pages … Anyway, the url() helper is your friend