Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

Change event back button behavior and text when multiple event pages are in use


BFGS

Question

Site URL: https://springtail-pufferfish-lyy6.squarespace.com/

Password for site entry: repair2021

I've used some code from @tuanphan to customize the behavior of an event back button. The code changes "Back to events" to "Back to listings" and also redirects to a particular page. 

The issue I'm having is that I have two separate events pages — one being used as a directory and the other being used as intended. I would like the wording and page redirect to be independent for each page. How do I achieve this?

The behavior is working correctly for this page:
https://springtail-pufferfish-lyy6.squarespace.com/board-listings


But needs to be altered for this page:
https://springtail-pufferfish-lyy6.squarespace.com/events

 

Here's the code I'm using:

<!-- Change board listing back button behavior -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script>
jQuery(function($){
    $(".eventitem-backlink").html(function() { 
          return $(this).html().replace("Back to All Events", "Back to listings");  
    });
  $('.eventitem-backlink').attr('href','/board-listings');
});
</script>
<!-- end Change board listing back button behavior -->

I would greatly appreciate any help on this!

Link to comment
  • Answers 4
  • Created
  • Last Reply

Top Posters For This Question

4 answers to this question

Recommended Posts

  • 0
On 5/18/2021 at 11:28 AM, BFGS said:

Site URL: https://springtail-pufferfish-lyy6.squarespace.com/

Password for site entry: repair2021

I've used some code from @tuanphan to customize the behavior of an event back button. The code changes "Back to events" to "Back to listings" and also redirects to a particular page. 

The issue I'm having is that I have two separate events pages — one being used as a directory and the other being used as intended. I would like the wording and page redirect to be independent for each page. How do I achieve this?

The behavior is working correctly for this page:
https://springtail-pufferfish-lyy6.squarespace.com/board-listings


But needs to be altered for this page:
https://springtail-pufferfish-lyy6.squarespace.com/events

 

Here's the code I'm using:


<!-- Change board listing back button behavior -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script>
jQuery(function($){
    $(".eventitem-backlink").html(function() { 
          return $(this).html().replace("Back to All Events", "Back to listings");  
    });
  $('.eventitem-backlink').attr('href','/board-listings');
});
</script>
<!-- end Change board listing back button behavior -->

I would greatly appreciate any help on this!

Try

<!-- Change board listing back button behavior -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script>
jQuery(function($){
  	if (window.location.pathname.split('/')[1] == "board-listings") {
    	$(".eventitem-backlink").html(function() { 
              return $(this).html().replace("Back to All Events", "Back to listings");  
        });
        $('.eventitem-backlink').attr('href','/board-listings');
    }    
});
</script>
<!-- end Change board listing back button behavior -->

this will affect on board listings only

Greeting, it's BaNgan from BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Youtube Gallery for Squarespace
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment
  • 0

@bangank36 — thank you for your help. I've inserted your code and it is not working for me. It's now returned to "Back to all events" for both events pages that I'm using + the routing via eventitem-backlink is not working / directing to the correct page.

Link to comment
  • 0
35 minutes ago, BFGS said:

@bangank36 — thank you for your help. I've inserted your code and it is not working for me. It's now returned to "Back to all events" for both events pages that I'm using + the routing via eventitem-backlink is not working / directing to the correct page.

i misread, change the string to "board-postings" to make it work

<!-- Change board listing back button behavior -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script>
jQuery(function($){
  	if (window.location.pathname.split('/')[1] == "board-postings") {
    	$(".eventitem-backlink").html(function() { 
              return $(this).html().replace("Back to All Events", "Back to listings");  
        });
        $('.eventitem-backlink').attr('href','/board-listings');
    }    
});
</script>
<!-- end Change board listing back button behavior -->

 

Greeting, it's BaNgan from BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Youtube Gallery for Squarespace
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment

Create an account or sign in to comment

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


×
×
  • Create New...