Jump to content

Drop Down URL's Creating automatic 302 Redirects.

Recommended Posts

I need help fixing these 302 redirects on my site. 

It took me forever to figure out that the drop down URL's automatically redirect to the first menu item, but I don't know how to fix it. Drop Down URL's.

Google Ads has continuously flagged this website as "Compromised" and "Circumventing Systems". I took over this project from a team member who left, so I have been trying to work through all her coding, running malware scans and using SEM Rush. This is my first site launch so there is a learning curve. 

I know 302 redirects really shouldn't impact ads being run, but at this point I want the site optimized to the best of my ability. So when I appeal this time it will go through. I haven't been able to get this client's ad campaign live since "The Golf Pages" were activated in late March. 

 

 

Screenshot 2024-05-23 at 2.20.43 PM.png

Screenshot 2024-05-23 at 2.21.35 PM.png

Link to comment
  • Replies 3
  • Views 2.3k
  • Created
  • Last Reply

Top Posters In This Topic

Hi @AshleyAR,

I'm happy to help you.

Yes, this dropdown menu automatically creates a 302 redirect. It's a Squarespace functionality and won't affect your website's search engine performance.

If you'd like to fix this with custom coding (though I'm not 100% sure), you can try the following:

  • Add the below code into your Settings » Advanced » Code Injection » Footer area. This code will turn any folder, with a url that ends in -folder/, into a clickable folder. The url preceding the -folder/ will be the clickthrough url. For example, in the below example the folder will clickthrough to the page /pagename

  • Code:

    <script>
    
    (function () {
    
    let folders;
    
    function rebuildAnchor(folder) {
    
    let parent = folder.closest('.header-nav-item--folder'),
    
    href = folder.href.includes('.com') ? folder.href.split('.com')[1].replace("-folder/", "") : folder.href.replace("-folder/", ""),
    
    anchorClone = folder.cloneNode(true);
    
    anchorClone.classList.add('clickable-folder');
    
    anchorClone.setAttribute('href', href);
    
    anchorClone.style.cssText = `
    
    opacity: 1;
    
    transform: unset;
    
    `;
    
    parent.insertAdjacentElement('afterbegin', anchorClone);
    
    if (href == window.location.pathname) {
    
    console.log()
    
    anchorClone.closest('.header-nav-item--folder').classList.add('header-nav-item--active')
    
    }
    
    }
    
    function addToMobile(folder) {
    
    let href = folder.getAttribute("href"),
    
    hrefAdjusted = href.includes('.com') ? href.split('.com')[1].replace("-folder/", "") : href.replace("-folder/", ""),
    
    text = folder.innerText,
    
    newText = `All ${text}`,
    
    mobileFolder = document.querySelector(`[data-folder="${href}"]`),
    
    backButton = mobileFolder.querySelector(".header-menu-nav-folder-content > *:first-of-type"),
    
    allButton = `<div class="container header-menu-nav-item header-menu-nav-item--external">
    
    <a href="${hrefAdjusted}">${newText}</a>
    
    <div>`;
    
    backButton.insertAdjacentHTML('afterend', allButton)
    
    }
    
    /* Select All Folder Links & */
    
    function setFolderLinks() {
    
    folders = document.querySelectorAll('.header-display-desktop .header-nav-folder-title[href*="-folder/"]');
    
    for (let folder of folders) {
    
    window.addEventListener('load', function() {
    
    addToMobile(folder);
    
    rebuildAnchor(folder);
    
    folder.remove();
    
    });
    
    }
    
    }
    
    setFolderLinks();
    
    })();
    
    </script>

 

If you've any further question, feel free to ask.

 

Best wishes,
Sadul Sifat

SEOSpace Team

SEOSpace - The SEO Plugin for Squarespace.

Get a Free Squarespace SEO Audit: https://www.seospace.co/squarespace-seo-audit-score

seospace-logo.png

Link to comment
  • 3 weeks later...
  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.