CMS Development

Dave2Dev
Contributor

Blog Listing Enumeration

SOLVE

Is there an easy way to show the blog posts number? 

 

For example:

Your first post would be number 1 and your fifth would be number 5. It would look something like this where you can treat the blog post like episode numbers:

Dave2Dev_0-1702419800248.png

 

I tried using the {{ loop.index }} but the index restarts whenever you paginate to the 2nd, 3rd... etc pages.

 

I couldn't find a HubL function/Filter that will number the my blog posts.

 

My current solution is a custom macro function that utilizes a lot of external variables and I'm afraid it makes it a fragile function.

 

If there isn't any easy solution to index the blog posts, is there a HubL variable or easy way to to obtain the blog's listing number. You usually find the blog listing number within the settings

0 Upvotes
1 Accepted solution
Jnix284
Solution
Hall of Famer

Blog Listing Enumeration

SOLVE

@Dave2Dev completely understand wanting to avoid the manual process, it might be worth checking in the developer slack to see if anyone there has ideas - there are a lot of devs active in the slack that don't spend a lot of time here in the community


If my reply answered your question please mark it as a solution to make it easier for others to find.


Jennifer Nixon

View solution in original post

0 Upvotes
5 Replies 5
Dave2Dev
Contributor

Blog Listing Enumeration

SOLVE

Amazing! Didn't know about that. Will definitely give it a go.

 

Thanks again!

0 Upvotes
Jnix284
Hall of Famer

Blog Listing Enumeration

SOLVE

you're welcome, it's a really active slack community with some of the best HS devs out there - just make sure you post in the right channel and don't post in multiple channels, that's the shortcut to not getting any help 😉

 


If my reply answered your question please mark it as a solution to make it easier for others to find.


Jennifer Nixon
Jnix284
Hall of Famer

Blog Listing Enumeration

SOLVE

@Dave2Dev are you already using the blog tags to categorize the episodes?

 

If not, you could use the tag feature to create the episode number and then use the HubL for tags in your template where you want the episode number to appear.

 

Doing this, I would remove any filtering capability so you don't have a really long list of episodes.

 

I can think of a few other workarounds, but they'd all be pretty fragile like the one you've suggested and I haven't tested them to know that they'd actually work.

 


If my reply answered your question please mark it as a solution to make it easier for others to find.


Jennifer Nixon
0 Upvotes
Dave2Dev
Contributor

Blog Listing Enumeration

SOLVE

Thank you for taking the time to review my question. 

 

I just didn't want the content manager to have to look at the previous episode to keep track of what the new episode (blog) number would be. 

 

Kind regards! 

0 Upvotes
Jnix284
Solution
Hall of Famer

Blog Listing Enumeration

SOLVE

@Dave2Dev completely understand wanting to avoid the manual process, it might be worth checking in the developer slack to see if anyone there has ideas - there are a lot of devs active in the slack that don't spend a lot of time here in the community


If my reply answered your question please mark it as a solution to make it easier for others to find.


Jennifer Nixon
0 Upvotes