creedexan Posted June 8, 2022 Posted June 8, 2022 Site URL: http://theconcilio.org Hi all, I've inherited a bilingual Squarespace site and recently the nav menu started displaying in both languages (English and Spanish) on secondary pages (but not on the English or Spanish home page). Please see attached screenshot. How can I fix this so that the English navigation menu items appear only on the English side and vice versa for the Spanish? The site was built in Squarespace 7.0 using the Brine family template. For the multilingual functionality, the site uses the code from Brad Good's excellent tutorial. I know it has something to do with the nav not excluding things correctly, but I've checked all the URLs and all use the /en/ or /es/ prefix. So, I'm not sure what has happened. Please see code below from the code injection. Thanks in advance for your help. <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/flag-icon-css/2.6.0/css/flag-icon.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> $(function() { /* SETUP MULTI-LANGUAGE */ var defaultLanguage = 'en'; var lang = location.pathname.split("/")[1]; var defaultClass = 'lang-'+defaultLanguage+''; var itemParent = "nav [class*='collection'],nav [class*='folder'],nav [class*='index'],nav [class*='group']"; if (lang == "" || lang.length > 2 ){ var lang = defaultLanguage; } /* ADD LANGUAGE CLASSES */ $('a[href="/"]').addClass('lang-'+defaultLanguage+'').parents(itemParent).addClass('lang-'+defaultLanguage+''); $('nav a:link:not([href^="http://"]):not([href^="https://"])').each(function () { var langType = $(this).attr('href').split("/")[1]; var multiLanguageClass = 'multilanguage lang-' + langType + ''; if (undefined !== langType && langType.length <= 2) $(this).addClass(multiLanguageClass).parents(itemParent).addClass(multiLanguageClass); }); $('nav button').each(function () { var langTypeFolder = $(this).attr('data-controller-folder-toggle').split("/")[0]; var multiLanguageClass = 'multilanguage lang-' + langTypeFolder + ''; if (undefined !== langTypeFolder && langTypeFolder.length <= 2) $(this).addClass(multiLanguageClass); }); /* HOMEPAGE-LOGO LINKS TO PROPER LANGUAGE HOMEPAGE */ if (lang == "es") { $('a[href="/"]').attr("href", "/es/inicio/"); } /* ADD EXCLUSION NAV ITEMS */ $('.exclude-me,.exclude-me a').addClass('exclude'); $('.sqs-svg-icon--list a,.SocialLinks-link').addClass('exclude'); /* REMOVE OTHER LANGUAGES AND KEEP EXCLUDED ITEMS */ $('.multilanguage:not(".lang-'+lang+',.exclude")').remove(); /* SETUP LANGUAGE SWITCHER */ $('body').prepend('<div class="language"><a href="/en/home" class="lang-en"><span class="flag-icon flag-icon-us"></span></a> <a href="/es/inicio/" class="lang-es"><span class="flag-icon flag-icon-mx"></span></a></div>'); }); </script>
Solution paul2009 Posted June 8, 2022 Solution Posted June 8, 2022 1 hour ago, creedexan said: How can I fix this so that the English navigation menu items appear only on the English side and vice versa for the Spanish? The site was built in Squarespace 7.0 using the Brine family template. It looks like someone has enabled Ajax Page Loading in Design > Site Styles. If you disable this, it should behave as expected. Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links. Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.
creedexan Posted June 9, 2022 Author Posted June 9, 2022 Thanks so much, @paul2009. Please excuse my ignorance, but I don't have an option to turn off Ajax Page Loading through Site Styles. I found some code to inject through a search on how to disable Ajax page loading (please see code below), but it doesn't seem to work. <script src="https://content1.getnarrativeapp.com/ss-ajax-loader.js"></script> Do you know of another option?
paul2009 Posted June 9, 2022 Posted June 9, 2022 3 minutes ago, creedexan said: Please excuse my ignorance, but I don't have an option to turn off Ajax Page Loading through Site Styles. No problem. The Site Styles panel is interactive and will only show the 'tweaks' that are relevant to the page you are previewing at the time. For example, the Ajax Page Loading tweak will not appear when you are looking at the cover page that is your homepage. You'll need to preview one of the other pages and then open the Site Styles panel. Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links. Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.
creedexan Posted June 9, 2022 Author Posted June 9, 2022 Thank you so much, @paul2009. That worked! paul2009 1
creedexan Posted June 9, 2022 Author Posted June 9, 2022 @paul2009 I'm so sorry -- one more question. Everything is working but now on the Spanish side of the site, if I click on the logo in the navigation, which should take users back to the language choice cover page, it can't find the page. The logo link works on the English side, though.
ravijava12 Posted July 23, 2022 Posted July 23, 2022 Does this exclude code work on Folders as well? I want to create a Folder (for a dropdown) for English and want to exclude this folder from the French. I've used the same script as mentioned in the start of this thread. I've been struggling for a while to find the answer, it'll be excellent if someone can help me here.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment