Jump to content

Summary Block for Blogs: How to hide current post?

Recommended Posts

I can't for the life of me figure out how to hide the active post in a summary block for blogs. So for instance, I want to feature a summary block showing "Related Posts," so I set it to the category of the current post, but the current post that the user is reading will still show up in the summary block. Is there a way to prevent that? There's no reason a user would want to click a link to the post they're already on, obviously.

This is on the Nueva template, though I haven't seen the feature in any template I've used.

Link to comment
  • 3 months later...
On 2/21/2020 at 4:04 AM, dubwebdev said:

Does anyone have a solution for this question? I'm running into the same issue and I'm certain there has to be a way to resolve this?

Can you share link to your blog page? I can take a look

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
  • 1 month later...
On 4/9/2020 at 1:46 PM, dubwebdev said:

There wasn't a solution for this based on what I researched. Perhaps @tuanphan can help you with the request. I ended up advising my client to leave it as is since the hassle was more time consuming that it was worth for all involved.

That's exactly the point where I'm up to. I could not find any solution to this either.

 It's extraordinary that you can't exclude posts and only include one category... It's SUCH an oversight. VERY annoying. Thanks for your reply. 

Link to comment
On 4/3/2020 at 1:26 PM, Creativore said:

@tuanphan I am having trouble with this also. I want to hide the current post in the summary block so it doesn't replicate itself on the page. 

Site: https://grey-sapphire-9lfk.squarespace.com/blog
Password: summary

It seems you solved?

24 minutes ago, Creativore said:

That's exactly the point where I'm up to. I could not find any solution to this either.

 It's extraordinary that you can't exclude posts and only include one category... It's SUCH an oversight. VERY annoying. Thanks for your reply. 

Can you share link to your blog?

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
35 minutes ago, tuanphan said:

It seems you solved?

Can you share link to your blog?

Hi @tuanphan,

Thank you so much for taking the time to help out. I am so grateful. I hope you are staying well and safe during these incredible times. X

I haven't been able to solve it. I tried one way but it was actually not going to work - it's been a complete nightmare - I'm perplexed as to how I can do this. 

Link to blog: https://grey-sapphire-9lfk.squarespace.com/articles

Password is summary

Thanks mate. 🙂 

Link to comment
3 minutes ago, Creativore said:

Hi @tuanphan,

Thank you so much for taking the time to help out. I am so grateful. I hope you are staying well and safe during these incredible times. X

I haven't been able to solve it. I tried one way but it was actually not going to work - it's been a complete nightmare - I'm perplexed as to how I can do this. 

Link to blog: https://grey-sapphire-9lfk.squarespace.com/articles

Password is summary

Thanks mate. 🙂 

Post in pagination or sidebar?

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
5 minutes ago, tuanphan said:

Post in pagination or sidebar?

I'm not sure what you mean. The blog articles are listed in that page. Individual articles are: https://grey-sapphire-9lfk.squarespace.com/articles/colour-theory-and-how-it-sells

https://grey-sapphire-9lfk.squarespace.com/articles/signwriter-anthropology

https://grey-sapphire-9lfk.squarespace.com/articles/logo-file-extensions

Once again, thank you. X

Link to comment
2 minutes ago, Creativore said:

Try adding to Home > Design > Custom CSS

.collection-type-blog.view-item .summary-item-list .sqs-active-slide {
    display: none;
}

 

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
4 minutes ago, tuanphan said:

Try adding to Home > Design > Custom CSS


.collection-type-blog.view-item .summary-item-list .sqs-active-slide {
    display: none;
}

 

OK, I nearly cried then because I thought it had worked. It does work on the latest article but not the previous ones. It actually takes the latest article out of the other summary blocks in the previous articles. Does that make sense?

You are still bloody amazing though. I'm so grateful for your efforts. 

Link to comment
  • 5 weeks later...
  • 1 month later...

Could anyone help out with this one to hide the current product?

I've added a summary block into the additional info section of the product editor and similar to above, it will include the current product you are viewing

Link to comment
  • 3 weeks later...

I can't believe this is not a standard feature and that more people are not requesting it! 🙄 I've seen a number of paid 3rd party plugins that do this very thing, so it can obviously be easily done. I don't see why I should have to pay a 3rd party on top of my paid squarespace business plan in order to achieve such a basic function. 😡

I contacted support about this issue and received a very polite but useless reply. Basically the options were;

1. Add specific tags to every single post I want to feature as a related post. This is a ridiculous suggestion!

  • It would need to be done on every single post, every single time.
  • If you want a post to show up as a related post on multiple posts you would need to add a seperate tag for each unique post so the tags would get crazy long.
  • You would also need to hide tags for every post so all those random tags don't show up and confuse the reader.
  • It would also mean that the related posts do not refresh by category unless you manually deleted and added new tags to every post on a regular basis.

2. Use custom code. The whole reason I use Squarespace is because I don't know how, and don't want to learn or deal with custom coding. Squarespace will not provide any support for custom code so even if I was willing to give it a go I wouldn't know what code to use or where to start.

I'd love to hear if anyone has any updates or advice on custom code that:

  • Hides the active post from the related posts of the same category on that specific post
  • Does not then hide the active post from showing up as a related post on other active posts
  • Allows the related posts to update over time based on new blog posts added to that specific category
  • Does not require to hide tags on each post or manually add unique tags to each post

I'd be really interested to hear from anyone using a theme that has the related posts function included in it's design. Does it automatically hide the active post? If so is there a way to reverse engineer a solution using the same code?

Am I wrong to think that it really doesn't seem like a big ask for such basic functionality?

Link to comment
On 6/17/2020 at 6:10 AM, SanitiseThis said:

Could anyone help out with this one to hide the current product?

I've added a summary block into the additional info section of the product editor and similar to above, it will include the current product you are viewing

@SanitiseThis

I have one summary block showing a single blog article that I have tagged as FEATURED. Then below it, I have another summary block with 30 items. I did not want to repeat the FEATURED post in that block. It is not the most elegant or perfect solution but I have simply told the first item in the specific summary block not to display. (In this case, it worked for me because I plan to always have the most recent blog article as the featured article - this would not work if the featured article was not the most recent. I know this is not the best but maybe it will inspire some ideas. Half of this stuff is being creative with the CSS LOL)

Example:

#block-yui_3_17_2_1_1594082530518_15247
.summary-item:nth-child(1) {
  display: none;
}

Edited by theresa.southern
Link to comment

The website it about to go live so it will probably be lynnepalmerinc.com/insights-executive-recruitment-blog but if not, it is https://emu-jaguar-5y4h.squarespace.com/insights-executive-recruitment-blog and the password is lp -- that is a lowercase L and lowercase P.

 

I have been able to hide the first (most recent) post. That is fine. BUT, when I do, there is an empty space showing up in the first row of the summary block. Here are the two codes I have used.

Can anyone help? For now, I have the code disabled. 

 

#block-yui_3_17_2_1_1594082530518_15247

.summary-item:nth-child(1) {

  display: none;

}

 

#block-yui_3_17_2_1_1594082530518_15247
.sqs-active-slide  {
  display:none!important;
}

 

thank you!!!!

Link to comment
  • 3 weeks later...

This  hide active post is something that Avenue does with index pages, which is a summary page for all pages except blogs. I use it but it leaves an empty space, as well. I can take it or leave it. The blog side, my summary page which has over 80 posts on it, does not hide the active blog post, but it navigates away from the page. If someone goes back to the summary page the post they were reading is still visible but I really don't think that matters all that much, not with my layout. 

my random views derrick Lee parker

Edited by derricksrandomviews
Link to comment
  • 9 months later...

Hi @tuanphan Just checking to see if the above question was solved or not. We are having a similar situation where we have a summary slider with hero images and it would be awesome if the images didn't go to a blank post page. Also, the site is working beautifully when I am previewing it with the edit but in a private window and on mobile the "slider" is supposed to be formatted to scroll from left to right but right now its showing all of the slides from top to bottom. Could you take a look if you have a moment? Thank you in advance. The site link is: https://carnation-cinnamon-brt4.squarespace.com/home and password is: Doves2021! 

Screen Shot 2021-05-20 at 2.05.58 PM.png

Screen Shot 2021-05-20 at 2.05.40 PM.png

Link to comment
  • 4 weeks later...

To remove current post, add 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');
        }

        removeMatchingPageFromRelatedPosts();
    });
</script>

Code by @RyanDejaegher 

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
  • 6 months later...
On 6/17/2021 at 8:13 PM, tuanphan said:

To remove current post, add 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');
        }

        removeMatchingPageFromRelatedPosts();
    });
</script>

Code by @RyanDejaegher 

I've tested this on multiple sites and it works perfectly. Excellent work!

Link to comment
  • 3 weeks later...
On 6/18/2021 at 10:13 AM, tuanphan said:

To remove current post, add 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');
        }

        removeMatchingPageFromRelatedPosts();
    });
</script>

Code by @RyanDejaegher 

The code does a great job at removing the active blog post, however I have a setup where I have a summary block that displays three posts at the bottom of each post. What that code does is removes the active post, but doesn't replace it with the next post, so I'm left with two posts displayed.

While I could make it so four posts are displayed, there will be blog posts where the active post won't be visible in the summary block at the bottom. 

Here is a page of an example; https://thedesignemotive.com/episodes/homes/a-house-for-all-seasons-polystudio

Link to comment
1 hour ago, anthonyrichardson said:

The code does a great job at removing the active blog post, however I have a setup where I have a summary block that displays three posts at the bottom of each post. What that code does is removes the active post, but doesn't replace it with the next post, so I'm left with two posts displayed.

While I could make it so four posts are displayed, there will be blog posts where the active post won't be visible in the summary block at the bottom. 

Here is a page of an example; https://thedesignemotive.com/episodes/homes/a-house-for-all-seasons-polystudio

I checked source code & it shows 3 post only (if remove the code). Can you try seting 4 or 5, 6 then check again?

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
  • 2 weeks later...

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.