Jump to content

sabrine

Member
  • Posts

    7
  • Joined

  • Last visited

Posts posted by sabrine

  1. @creedon still no luck...

    here's what i have pasted into the header section:
     

    Quote

     

    <script>

      $( ( ) => {
     
        /*
        
          begin make navigation folder URL Slugs clickable
          
          Version      : 0.5d2
          
          SS Version   : 7.1
          
          Dependancies : jQuery
          
          By           : Thomas Creedon < http://www.tomsWeb.consulting/ >
          
          */
          
          const folderToPageUrlSlugMap = {
          
            /*
            
              adding lines here is optional, when no lines are added the folder will
              link to the first page in the folder
              
              the format of each line is a folder page URL Slug and a destination
              page URL Slug
              
              for each folder page copy value from Folder Settings > General >
              URL SLUG field. you only need exactly what can be selected from the
              field
              
              for each destination page copy value from page Settings > General >
              URL SLUG field. you only need exactly what can be selected from the
              field
              
              duplicate the line below and remove the "// " at the beginning of the
              line
              
              */
              
            // '[enter folder page url slug here]' : '[enter page url slug here]',
            '/roster' : 'rosterfr',
            
            }
            
          // do not change anything below, there be the borg here
          
          if ( ! Object.keys ( folderToPageUrlSlugMap ).length ) {
          
            $( '.header-nav-folder-title' ).each ( function ( ) {
            
              const $this = $( this );
              
              const key = $this
              
                .attr ( 'href' )
                
                .slice ( 1 );
                
              let url = $this
              
                .next ( )
                
                .find ( '.header-nav-folder-item:first a' )
                
                .attr ( 'href' );
                
              if ( url === undefined ) return true;
              
              url = url.slice ( 1 );
              
              folderToPageUrlSlugMap [ key ] = url;
              
              } ); // end each
              
            }
            
          const keys = Object.keys ( folderToPageUrlSlugMap );
          
          $.each ( keys, function ( i, key ) {
          
            let url = folderToPageUrlSlugMap [ key ];
            
            if ( ! url.includes ( '://' ) ) url = '/' + url;
            
            $( '.header-nav-folder-title[href="/' + key + '"]' )
            
              .each ( function ( ) {
              
                $( this )
                
                  .attr ( 'href', url )
                  
                  .click ( function ( ) {
                  
                    location.href = $( this ).attr ( 'href' );
                    
                    } );
                    
                } ); // end each
                
            } ); // end each
            
          // end make navigation folder URL Slugs clickable
          
        } );
        
      </script>

     

    and the footer:

    Quote

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

    perhaps it is another piece of code that is preventing this from working?

×
×
  • 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.