Jump to content

Customise the 'Back to All Events' URL and display text for an event list

Recommended Posts

Add to Home > Settings > Advanced > Code Injection > Footer

<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", "New text");  
    });
});
</script>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
<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", "New text");  
    });
  $('.eventitem-backlink').attr('href','https://beaverhero.com');
});
</script>

replace beaverhero with new url

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • 5 months later...

@nathanchien

Please post the URL for your event page on your site.

If your site is not public please set up a site-wide password, if you've not already done so.

Post the password here.

Adding a site-wide password is not a security breach. Please read the documentation at the link provided to understand how it works.

We can then take a look at your issue.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
  • 2 years later...

Let me give you the background of what I need to do. A better answer has to exist.

The site I'm deploying has two calendars: Preschool Events and K-8th Events. Instead of sending the user back to All Events, I want to send them back to the calendar page from whence they just came.

I've read the two other articles on changing the URL of the Back to All Events link, and in both, the new target was a fixed URL. I would like to have the script automatically determine by some criteria (document referrer, category, tag, etc) which of the two calendar pages the user came from based on where they are and make that URL the target of the back button.

Diagnostic Testing (Reading and Math) — The SAE School (squarespace.com)

K-8 Events — The SAE School (squarespace.com)

Preschool Events — The SAE School (squarespace.com)

My thinking on adding a second link where your red box is was to just create two manual static links and avoid all logic.

Edited by captbackfire
Link to comment
On 6/23/2023 at 9:48 PM, captbackfire said:

Let me give you the background of what I need to do. A better answer has to exist.

The site I'm deploying has two calendars: Preschool Events and K-8th Events. Instead of sending the user back to All Events, I want to send them back to the calendar page from whence they just came.

I've read the two other articles on changing the URL of the Back to All Events link, and in both, the new target was a fixed URL. I would like to have the script automatically determine by some criteria (document referrer, category, tag, etc) which of the two calendar pages the user came from based on where they are and make that URL the target of the back button.

Diagnostic Testing (Reading and Math) — The SAE School (squarespace.com)

K-8 Events — The SAE School (squarespace.com)

Preschool Events — The SAE School (squarespace.com)

My thinking on adding a second link where your red box is was to just create two manual static links and avoid all logic.

What is access password?

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

 https://cinnamon-bellflower-84lt.squarespace.com/preschoolevents/preschool-meet-greet-dragon-drop-in

https://cinnamon-bellflower-84lt.squarespace.com/k8-events

You can add code to Page Header: Preschool Meet Event Page Header

<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 Preschool Events");  
    });
  $('.eventitem-backlink').attr('href','/preschoolevents');
});
</script>

and add this to K-8 Events Page Header

<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 K8 Events");  
    });
  $('.eventitem-backlink').attr('href','/k8-events');
});
</script>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (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...

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.