Jump to content

Summary Block Exclude Current Blog Post

Recommended Posts

  • 1 year later...

Try adding this to Code Injection > Footer

<script>
  window.addEventListener('load', function () {
    function removeMatchingPageFromRelatedPosts() {
      var currentPath = window.location.pathname;

      var matchingSummaryItem = document.querySelector(
        `[href="${currentPath}"]`
      );

      if (!matchingSummaryItem) return;

      var summaryParent = matchingSummaryItem.closest('.summary-item');

      summaryParent.remove();
      console.log('matching blog post removed');

      window.Squarespace.initializeLayoutBlocks(Y);
    }

    removeMatchingPageFromRelatedPosts();
  });
</script>

Code by @RyanDejaegher

Quote

 

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.