Jump to content

How to calculate and display the number of blog posts in a summary block?

Recommended Posts

Hi all,

Is there a way to calculate and display the number of blog posts in a summary block with a code block immediately before/above the summary block? (if there is another solution without using code block, of course let me know. I'm just guessing its going to have to involve a code block for how and where I want the information displayed.)

For example, after filtering, I have 300 blog posts and set the number of viewable blog posts to 30.

Here's text that I put in the image below for the time being to show what I would ideally like to achieve.

image.thumb.png.00a09686f93e8e51e9822389ebb063db.png

 

I'm going to have hundreds of these summary blocks and blog posts will be added daily which will change the number of posts in a number of summary blocks. So as much as I'd like to simply add text, it will be hard to keep up of the various changes to the summary blocks.

One other important point. If I have less than 30 blog posts, the code would have to be adaptive to reflect this. So if I only have 20 posts, then the text should read "Showing results 1 - 20 of 20 projects".

This almost sounds impossible but I have seen it on another website so I imagine it has to be possible.

https://projectsinsider.com/collection/off-the-plan-and-new-projects/city-of-casey-vic

lifeisgood

Cheers.

Link to comment
  • 2 weeks later...
  • Replies 2
  • Views 509
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

15 hours ago, tuanphan said:

Hi,

You will use this for Summary Blocks only or Summary Block, Blog Page, Blog Category Filter page..?

Hi @tuanphan,

For Summary Blocks and Blog Page.

I may have several pages with different filters used on the Summary Blocks.

Thanks.

Edited by Insider
new information
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.