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

Books feature #41

Draft
wants to merge 4 commits into
base: gh-pages
Choose a base branch
from
Draft

Books feature #41

wants to merge 4 commits into from

Conversation

rathgar
Copy link
Contributor

@rathgar rathgar commented May 1, 2020

This is an idea of how books might work. The hope is that it will provoke discussion and help drive towards what might be useful (if this does turn out to be useful at all.)

They way I have it setup in this example is to use a books collection with its own layout that has no exciting structure. The author is free to lay it out as they see fit and either inject recipes using a standard looking include (not yet written) or just write them out in their own way. The book can be quite free-form in this manner as I think @clarklab was keen on. The clever part comes form the recipe end.

In recipes you can mark them as being part of any number of books.

books: [my-awesome-book]

This keeps the association with the recipe and makes life a bit easier. When viewing a recipe you can see which books it is in:

image

Also, at the bottom of the book you can see an index of the recipes that refer to it, and a list of books by the same author:

image

Authors are identified in _data/people.yml - which no doubt will find uses elsewhere. We could even use them as the 'chef' of a recipe?

As I say, although very much a functioning idea, this is still just an idea and open to ravaging change.

@rathgar rathgar mentioned this pull request May 1, 2020
@MichaelThomasMPT
Copy link
Contributor

This looks great!

@clarklab
Copy link
Owner

clarklab commented May 3, 2020

Quick response: heck yeah!

I've got a busy week but I'll try to make some time to check it out a bit more. It looks like a very promising start!

@rathgar
Copy link
Contributor Author

rathgar commented May 5, 2020

Good to hear I'm at least in the right ballpark 🥳

@MichaelThomasMPT
Copy link
Contributor

Hey @rathgar - I've been having a play around with this PR and it took me a while to realise I needed to include the following in my _config.yml:

collections:
...
  books:  
    output: true

Might be worth including this update in the PR.

Also do you have any examples of a book you've implemented? I've gotten the basics of one working but am not sure what all the properties are to include in the front matter.

It's looking good though - I'm keen to start using this more!

@rathgar
Copy link
Contributor Author

rathgar commented May 18, 2020

Thanks for catch! I'm so careful not to commit my _config.yml edits and forgot that essential one. In an attempt to avoid polluting the PR I'll put some example code here. It's pretty straight forward:

For a book eg _books/perfect-loaf.html you'll need some front matter like this:

---
layout: book
title: Perfect Loaf
cover: perfect-loaf.jpg
description: How to bake the perfect loaf of bread.
covernotes: A longer covernote exlainging the purpose of the book.
author: rue-turner
---

<p>Any HTML you fancy.</p>

In a recipe, add the following:

books: [perfect-loaf]

Be sure to add the author to the _data/people.yml - instructions are at the top of the file. Only a name is required at this stage.

That's it really. The books are html with front matter so can contain any HTML you fancy, including styling if you need it.

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

Successfully merging this pull request may close these issues.

3 participants