Closed filipesaraiva closed 6 years ago
This is odd. It is possible to iterate multiple times on the same data and it is also possible to invoke the generator multiple times on the same data, although it makes sense only if you are generating pages in different directories.
I have updated the example site with multiple iterations on the same data. Have a look at the book
section
Can you share some relevant code to have a look at what is going on?
Hello @avillafiorita, thanks for your attention. In fact it is common to iterate multiple times on the same data but I would like to iterate again while a previous iteration is running yet.
My case is: I have a laboratory website where I would like to put the name of students in their respective supervisors pages. For instance:
- display_name: "Filipe Saraiva"
role: supervisor
- display_name: "Marcos Sousa"
role: student
supervisor: "Filipe Saraiva"
So, while I am building the page for "Filipe Saraiva", I want to iterate in the same data file again in order to get the students where the supervisor has the name "Filipe Saraiva".
Is it possible to do that? I can not to do this in my tests.
Have you tried something along the lines of:
{% for person in site.config.people %}
* {{ person.display_name }}
{% for student in site.config.people %}
{% if student.supervisor == person.display_name %}
- {{ student.display_name }}
{% endif %}
{% endfor %}
{% endfor %}
(double check the if condition, since I am going by heart).
I have a people.yml file with information about researchers from a laboratory. In that file there are supervisors and students.
I would like to put students names in the supervisor page. I am trying to iterate in people.yml file again when generating the supervisor pages, but looks like it is not possible. None information is returned.
Well, is there a way to iterate in that file again while generate pages from it?