Working with for loops for display lists


#1

https://pizzapgh.github.io/test_bsb/specials-page.html

I have my specials displayed in a list using a for loop and when clicked on the specials details spit out underneath. The problem I want the most recent special to spit when the user arrives on the special page without having to be clicked on. I would imagine there would have to be some kind of condition for this. This is beyond my skill set. Could someone help point me in the right direction?


#2

I think you already know how :slight_smile: you just a bit afraid to experiment… simply embed the first post content into your Specials page and this is it.

Put the following snippet into specials-page.html and you are done:

---
layout: specials-post
---

{{ site.categories.specials-collect.first.content }}

I forked your repo and put together an example how does it look like: https://ptsurbeleu.github.io/test_bsb/specials-page.html.

And here is the Github’s repository with the change: https://github.com/ptsurbeleu/test_bsb.

And I also sent a pull request, so you can accept it and get the changes in your repository instantly.

Let me know if that is what you are looking for :wink:


#3

BTW, I like the way you organized Specials pages - very smart, I would have never though about putting together an empty page with the same layout as an entry point (eq. parent) for other pages/content to show up!

:+1:


#4

Ahh, what a gift I woke up to this morning. I pulled in the changes. This exactly what I’m looking for. Thanks man. :slight_smile:


#5

Enjoy! :wink: Glad it has worked for you!