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

use collections as much as possible #4

Open
dotnwat opened this issue Apr 20, 2016 · 4 comments
Open

use collections as much as possible #4

dotnwat opened this issue Apr 20, 2016 · 4 comments

Comments

@dotnwat
Copy link
Member

dotnwat commented Apr 20, 2016

@csbao i noticed that there is a people collection that contains a file per person, and a data file that contains metadata about each person, including a blurb. is your intention to use data, collections, or a combination of both?

If you are running into problems with organizing the data and accessing it in the templates, I have a working example of something very similar to what we want with people but without using the jekyll data feature:

https://github.com/camready/camready.github.io/tree/master/_calls

@csbao
Copy link
Contributor

csbao commented Apr 20, 2016

My intention was to use both data and collections.
The data file would contain the metadata, including a blurb. The page itself would list out metadata, and then link ("Read more about so-and-so") to that person's own page on the site, which would presumably include more information about that person.

Sorry if this wasn't clear.
I'll take a look at the link. Thanks!

@dotnwat
Copy link
Member Author

dotnwat commented Apr 20, 2016

I definitely think we want things to be as simple as possible. If we can have instructions for adding a person which is:

  1. Add a file for the person under _people/first-last.md

That is much simpler than:

  1. Add a file for the person under _data and _people
  2. Add some metadata to one and some to the other.

The link I provided in the previous post shows how to do that. Let me know if you want some help with it. It took me a while to figure out how to make it work, so I'm happy to transfer that knowledge.

@csbao
Copy link
Contributor

csbao commented Apr 21, 2016

Hmm okay.

So here's what I understand so far:

Right now we have people.markdown as

for person in site.data.faculty: 
     //DO STUFF

for person in site.data.phd:
     //DO STUFF
...

We should change this to:

<h1>FACULTY</h1>
for person in site.people: 
     if person.category=='faculty':
         //DO STUFF

<h1>PHD STUDENTS</h1>
for person in site.people:
     if person.category=='phd':
        //DO STUFF
...

So that _people contains every single person (this is similar in setup to what we have with _projects), and there are 4 loops over site.people (one ea for faculty, phd, staff, and alumni).
Doing it this way would mean there is no need for _data/{people}.yml. I can just remove them.

Right?

@dotnwat
Copy link
Member Author

dotnwat commented Apr 21, 2016

Yeh, sounds good.

Ideally Jekyll could use categorical information taken from the collection yaml front matter (or somewhere else) to make the iteration by category nicer. And perhaps it does, but I'm not sure how to make that happen. I searched a little for a solution, but I ran out of time finding something.

In the camready link I sent you, I make it a little nicer when writing templates using something like this where i create a variable with the filter already applied so the loops don't have the if statement.

{% assign calls = site.calls | where:"venue",page.venue | where:"layout","call" %}

Overall I'd like the goal to be to minimize the effort and complexity needed to add or modify content. And if that means that the templates and other infrastructure type stuff is a bit more complex, then that is OK because that changes less often and by fewer people.

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