11ty / eleventy-base-blog

A starter repository for a blog web site using the Eleventy static site generator.
https://demo-base-blog.11ty.dev/
MIT License
1.24k stars 616 forks source link

Post List Numbering : Question #47

Closed ng-chicago closed 4 years ago

ng-chicago commented 5 years ago

Is it possible to show the numbering for all of your posts instead of just the number is shown on the home page? So if you have 57 posts, but are only showing the 3 most recent, the numbering would be

3 Latest Posts 57 blah blah 56 blah blah 55 blah blah

More posts in the archive.

zachleat commented 4 years ago

A ha! I have added this to the eleventy-base-blog repo on the index page. I added a postslistCounter variable that does it: https://github.com/11ty/eleventy-base-blog/blob/03bb550d4698c8db48d86195cca597a72e43269b/index.njk#L11

zachleat commented 4 years ago

You can see how it’s used inside of the include here: https://github.com/11ty/eleventy-base-blog/blob/03bb550d4698c8db48d86195cca597a72e43269b/_includes/postslist.njk#L1