Jump to content

desg

Member
  • Posts

    1
  • Joined

  • Last visited

desg's Achievements

Level 1

Level 1 (1/20)

0

Reputation

  1. I've tweaked @RyanDejaegher's code to avoid the empty space issue. First add the following to your code: <script> window.addEventListener('load', function () { function removeMatchingPageFromRelatedPosts() { var currentPath = window.location.pathname; var matchingSummaryItem = document.querySelector( `[href="${currentPath}"]` ); if (!matchingSummaryItem) { console.log('cant find matching blogpost, removing last instead') matchingSummaryItem = document.querySelector( 'div.summary-item:last-of-type' ); } if (!matchingSummaryItem) return; var summaryParent = matchingSummaryItem.closest('.summary-item'); summaryParent.remove(); console.log('matching blog post removed'); window.Squarespace.initializeLayoutBlocks(Y); } removeMatchingPageFromRelatedPosts(); }); </script> Now update your Summary block to display one more item than you want, e.g. if you want to show 4 items, configure 5 to be retrieved. This code will either remove the matching post, or the last one in the list.
×
×
  • 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.