Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post List Numbering : Question #47

Closed
ng-chicago opened this issue Oct 13, 2019 · 2 comments
Closed

Post List Numbering : Question #47

ng-chicago opened this issue Oct 13, 2019 · 2 comments

Comments

@ng-chicago
Copy link

ng-chicago commented Oct 13, 2019

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 added a commit that referenced this issue Jan 3, 2020
@zachleat
Copy link
Member

zachleat commented Jan 3, 2020

A ha! I have added this to the eleventy-base-blog repo on the index page. I added a postslistCounter variable that does it:

{% set postslistCounter = collections.posts | length %}

@zachleat
Copy link
Member

zachleat commented Jan 3, 2020

You can see how it’s used inside of the include here:

<ol reversed class="postlist" style="counter-reset: start-from {{ (postslistCounter or postslist.length) + 1 }}">

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants