Jump to content

Limit event page generated excerpt to X lines/characters

Recommended Posts

Site URL: https://www.cryptofi.tech/events


I'm trying to limit the generated excerpt for events to "X" lines/characters. For example, on this webpage (https://www.cryptofi.tech/events) the first and third entries are short enough where the entire event fits into a reasonable size, but the second event is quite long as it includes additional event information and registration information. 

Ideally, this would cut off at "Learn more and register here." Squarespace's built-in excerpt function does not allow links, which prevents me from using that. I also have pointer-events disabled on post titles and images (because i don't want people to access the generated events pages for things like the 1st and 3rd entries).

I found this code before that I slightly edited to perhaps fit my needs, but I can't seem to get it to work and I'm not sure if I'm doing something wrong or it doesn't work in this scenario: 

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script src="https://www.jqueryscript.net/demo/Cropping-Text-Without-Breaking-Words-jQuery-Limit-Text/limit.text.min.js"></script>
$(function () {
length: 140

Any ideas? A fix for individual events could also work if there's a way to just limit the second event (and easily apply to future events that may have the same issue)

Thank you!

Link to comment
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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.