Jump to content

Limit summary excerpt on one section of index page only

Recommended Posts

Site URL: https://evolutionofbrilliance.squarespace.com/

Hello, I am using the below header code injection to limit summary excerpt's... (this has been successful when inserted into main 'blog' page)

<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>
<script>
$(function () {
  $('.summary-excerpt p').addClass('cuttext');
$('.cuttext').limitText({
length: 160
});
})
</script>

My issue is with the index homepage as I am using the summary block for a few different sections - in one instance I need the excerpt limited (I want this limited on the orange blog 'latest articles' section) but for blue 'testimonials' section, I need the full excerpt. Is there a way to have these two variations on an index page? 

Thank you

Pw: 123456

Screen Shot 2022-04-01 at 12.20.29 pm.png

Screen Shot 2022-04-01 at 12.20.39 pm.png

Link to comment

Try editing your code to

<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>
<script>
$(function () {
  $('.summary-v2-block:not(#block-yui_3_17_2_1_1648778322242_4527) .summary-excerpt p').addClass('cuttext');
$('.cuttext').limitText({
length: 160
});
})
</script>

 

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

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

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.