radicalbarracuda / sf-feminist-book-club

SF Feminist Book Club
1 stars 2 forks source link

Implement Object Data Model #39

Closed lizgene closed 7 years ago

lizgene commented 7 years ago

Background

Github training-kit uses a collections: concept that will allow us to represent the data on our site as objects. This will allow us to do something like list events, and then filter for readings or study_guides that belong to that event, and allow us to put in our _config.yml output: true to automatically generate html views for that collection on build.

More information on this type of content modeling here.

Why?

This will allow us to more logically represent data relationships in our code, instead of sticking to the simple idea of a post that jekyll encourages by default. It also lets us find related models with liquid templating without having to loop through our entire "database" of content.

Example:

{% assign architect = site.people | where: "object-id", page.architect-id  | first %}

<header class="intro project-header">
    <h1>{{ page.title }}</h1>
    <p>Architected by: <a href="{{ architect.url }}">{{ architect.first-name }} {{ architect.last-name }}</a></p>
</header>
<div class="project-body">
    {{ page.content }}
    <a href="{{ page.wikipedia-url }}">Read more about {{ page.title }} on Wikipedia</a>
</div>

Data Map

- Event Collection (output: true)
    - identifier
    - datetime
    - title
    - tags [social / discussion] # substance of event
    - facilitator_identifiers: [ person-identifier, person-identifier ]
    - reading_identifiers: [ reading-identifier, reading-identifier ]
    - meetup_identifier
    - slug
- People Collection
    - identifier
    - name
    - blurb
    - photo_url
    - roles []
- Reading Collection
    - identifier
    - tags [feminism / anti-racism] # subject material
    - title
    - authors
    - editors
    - goodreads_url
    - amazon_url
    - study_guide_identifier
- Study Guide (output: true)
    - identifier
    - slug
    - license_type
    - content

_config.yml

collections:
  events:
    output: true
  readings:
  study_guides:
    output: true
  facilitators:
dashosaur commented 7 years ago

I removed organizer_ids from the events model because we've never had organizers that aren't facilitators. We can add back if/when it happens.

lizgene commented 7 years ago

Resolved in: