Jump to content

Event Title link to SourceURL

Recommended Posts

Ok I solved this issue with limited drawbacks, so let me share the code I'm using for anyone looking for the same thing:

<!-- Replace event title and image links with link in excerpt -->
<script>
$(".summary-title").click(function() {
  window.open($(this).siblings(".summary-excerpt").find('p a').attr('href'), '_blank');
  return false;
});
$('.summary-thumbnail-outer-container').click(function() {
  window.open($(this).siblings(".summary-content").find('.summary-excerpt p a').attr('href'), '_blank');
  return false;
});  
</script>

I added it to the footer of my site. Its purpose is to update the URL of the links for events displayed via the "Summary Grid" element. It's not meant to (and it doesn't) update the URL for the default event page. 

Here are the drawbacks on my end:

  • The script pulls the URL not from the "Source URL" (it can't), but from a link you must have previously placed in the excerpt. Simply add a link in the excerpt with the destination URL you want, and the script will pick it up. You can then hide the link in the excerpt via CSS if you wish. My CSS is the following:
    .summary-item.summary-item-record-type-event .summary-excerpt.summary-excerpt-only a {
    	display: none;
    }
  • When the user hover over the event image or title, the URL preview in the browser shows the non-modified URL. However when the user clicks, they go directly to the URL from the excerpt link. Not an ideal user experience.

Feel free to try it on your site, it will work as long as you have the same HTML structure as me, otherwise you will have to modify the class names in the script (and the CSS) according to your context. 

Best of luck

Link to comment
  • 3 weeks later...

I too am having this issue.  I like the calendar function and view to show a summary but do not want to make use of the 'single event' details page.  I would like to create a standard page on the site with the event details on it.

I experimented putting an href in a code block on the single event page... but this seems clunky and now I can't get onto that event page to edited as my browser is tripping out.

I've had to recreate that event which isn't too hard but again not ideal... is there any merit or better way I can do this?  I'm thinking adding a button to the event summary is best although not sure if that is a feature or a custom css?

I'm very rookie at basic coding so talk to me as you would a non techy child.

Thanks

<script>
            window.location.href = 'desired details page on my site.co.uk';
</script>
Link to comment
On 11/18/2022 at 12:30 AM, RPlum said:

I too am having this issue.  I like the calendar function and view to show a summary but do not want to make use of the 'single event' details page.  I would like to create a standard page on the site with the event details on it.

I experimented putting an href in a code block on the single event page... but this seems clunky and now I can't get onto that event page to edited as my browser is tripping out.

I've had to recreate that event which isn't too hard but again not ideal... is there any merit or better way I can do this?  I'm thinking adding a button to the event summary is best although not sure if that is a feature or a custom css?

I'm very rookie at basic coding so talk to me as you would a non techy child.

Thanks

<script>
            window.location.href = 'desired details page on my site.co.uk';
</script>

You can add /config/safe after your site url to disable all Code Block on your site, then you can edit or remove it

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
  • 8 months later...
On 10/28/2022 at 6:36 PM, George said:

Ok I solved this issue with limited drawbacks, so let me share the code I'm using for anyone looking for the same thing:

<!-- Replace event title and image links with link in excerpt -->
<script>
$(".summary-title").click(function() {
  window.open($(this).siblings(".summary-excerpt").find('p a').attr('href'), '_blank');
  return false;
});
$('.summary-thumbnail-outer-container').click(function() {
  window.open($(this).siblings(".summary-content").find('.summary-excerpt p a').attr('href'), '_blank');
  return false;
});  
</script>

I added it to the footer of my site. Its purpose is to update the URL of the links for events displayed via the "Summary Grid" element. It's not meant to (and it doesn't) update the URL for the default event page. 

Here are the drawbacks on my end:

  • The script pulls the URL not from the "Source URL" (it can't), but from a link you must have previously placed in the excerpt. Simply add a link in the excerpt with the destination URL you want, and the script will pick it up. You can then hide the link in the excerpt via CSS if you wish. My CSS is the following:
    .summary-item.summary-item-record-type-event .summary-excerpt.summary-excerpt-only a {
    	display: none;
    }
  • When the user hover over the event image or title, the URL preview in the browser shows the non-modified URL. However when the user clicks, they go directly to the URL from the excerpt link. Not an ideal user experience.

Feel free to try it on your site, it will work as long as you have the same HTML structure as me, otherwise you will have to modify the class names in the script (and the CSS) according to your context. 

Best of luck

I've just tried using this code here:

https://www.mtarboretum.org/events-programs-alt

Using the August 26 event as a test, it doesn't appear to be sending folks to the external URL that I have in the excerpt when clicking on the event title or image. I've tried adjust the script slightly, without success.

I would be very grateful for any further solution!

Link to comment
On 8/4/2023 at 11:47 PM, debazer914 said:

I've just tried using this code here:

https://www.mtarboretum.org/events-programs-alt

Using the August 26 event as a test, it doesn't appear to be sending folks to the external URL that I have in the excerpt when clicking on the event title or image. I've tried adjust the script slightly, without success.

I would be very grateful for any further solution!

Which event are you referring to? I don't see any link in excerpt

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.