Streaming live at 10am (PST)

Custom code language switch help

I’m currently updating my website that is in 2 languages. I used the multi folder method with a custom code switch to navigate between both languages while staying on the same page. Thing is, the home page I want to use as the landing page is in a folder. How can I edit my code to make things work?

Here is the code I use in my footer code in project settings



  • switch current url
  • based on current language folder
  • short version :brain:
    (function switchLanguage() {
    const switchButton = document.getElementById(‘switchLink’);
    let protocol = window.location.protocol;
    let currentHost =;
    let pathNameArray = window.location.pathname.split(’/’);
    switchButton.addEventListener(‘click’, function() {
    if (pathNameArray1 == ‘fr’) { + ‘//’ + currentHost + ‘/en/’ + pathNameArray2, ‘_self’);
    } else if (pathNameArray1 == ‘en’) { + ‘//’ + currentHost + ‘/fr/’ + pathNameArray2, ‘_self’);

Here is my site Read-Only: