Multisite language switch redirects back to homepage. #6979
Answered
by
jasonvarga
japgroevemaker
asked this question in
Troubleshooting
-
Hello, I'm using Statamic with blade and i'm unable to figure out how to make a language switch which stays on the url you are currently visiting when you make a switch. The switch i have made so far redirects back to the homepage after switching the language. @foreach ($sites as $locale)
<a class="uppercase {{ $site->handle === $locale->handle ? 'active' : '' }}" href="{{ $locale->url }}">
{{ $locale->name }}
</a>
@if (!$loop->last)/@endif
@endforeach Can anyone please help me? Thanks in advance |
Beta Was this translation helpful? Give feedback.
Answered by
jasonvarga
Nov 1, 2022
Replies: 1 comment 1 reply
-
Use the locales tag instead. https://statamic.dev/tags/locales @foreach(Statamic::tag('locales')->id($id) as $item)
<li><a href="{{ $item['permalink'] }}">{{ $item['locale']['name'] }}</li>
@endforeach |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
japgroevemaker
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use the locales tag instead.
https://statamic.dev/tags/locales