I am currently working on a jekyll based homepage and I cant get pagination working.
<ul class="posts"> {% for post in paginator.posts %} <li> <span class="list_date">{{ post.date | date_to_string }}</span> » <span class="list_title"> {{ post.title }} </span><br> <span class="list_content">{{ post.content | strip_html | truncatewords:35}}</span> <a href="{{ post.url }}">more...</a> </li> {% endfor %} </ul>
This is my liquid code and it works perfectly well when using site instead of paginator. Also in my _config.yml I have this part:
paginate: 2 paginator_path: "news/page:num"
Since the index.html file is in the news folder
With many websites — especially blogs — it's very common to break the main listing of posts up into smaller lists and display them over multiple pages. Jekyll offers a pagination plugin, so you can automatically generate the appropriate files and folders you need for paginated listings.
Pagination in Jekyll only works in an index.html file. If you have other pages in the root of your project folder (say, about.html, poems.html) pagination will NOT work in them.
To have pagination work in another page other than your index.html, create a new folder for that page (say, poems/) and change what would have been "poems.html" to "poems/index.html". After that, your "paginate_path" in _config.yml should be 'paginate_path: "poems/page:num/"'.
I'm still investigating this issue. My site needs pagination on multiple pages...something which Jekyll doesn't seem to support out-of-the-box
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With