fin dynamic lang link so we dont have to reload

nav bar as much
This commit is contained in:
gws 2024-11-13 10:59:18 +01:00
parent be844107ea
commit db5d01f04a

View file

@ -32,17 +32,32 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if lang == "en"%} {% set hyper="on click halt the event then
<a class="nav-item subtitle-text" href="/sv{{ path }}"><img alt="swedish" class="flag" set path to window.location.pathname js(path)
src="/flag-for-sweden-svgrepo-com.svg" _="on click set path to window.location.pathname js(path) let arr = path.split('/');
console.log(path.split('/')) if (arr[1] == 'sv') {
return path end arr.shift();
log(it)"></a> arr.shift();
{% else %} } else if (arr[0] == 'sv') {
<a class="nav-item subtitle-text" href="{{ path }}"><img alt="english" class="flag" arr.shift();
src="/flag-for-united-kingdom-svgrepo-com.svg"></a> } else{
{% endif %} arr[0] = 'sv';
}
if (arr.slice(-1) == '' ) {
arr.pop();
}
arr.unshift(window.location.origin);
return arr.join('/') end
log(it)
then set window.location to it"%}
{% if lang == "en" %}
<a class="nav-item subtitle-text" href="/sv"><img alt="swedish" class="flag" src="/flag-for-sweden-svgrepo-com.svg"
_="{{ hyper }}"></a>
{% else %}
<a class="nav-item subtitle-text" href="/en"><img alt="swedish" class="flag"
src="/flag-for-united-kingdom-svgrepo-com.svg" _="{{ hyper }}"></a>
{% endif %}
<div class='toggle-dark'> <div class='toggle-dark'>
<label> <label>