jsoma / bottlejack

MIT License
1 stars 1 forks source link

List of all possible fields #11

Closed WillJarrettData closed 3 years ago

WillJarrettData commented 3 years ago

In the readme, please could we have a list of all possible fields for the homepage? I think I remember from our class that we can add additional fields other than type, title, slug, and url (e.g. a description field or an image field) but I don't know their names.

jsoma commented 3 years ago

Does this bit of the README help you? https://github.com/jsoma/bottlejack#the-homepage

Everything in the data.yaml page gets fed to the home.hbs template, creating a homepage. For example, the bio key in the YAML turns into {{ bio }} in the template, and links get looped through with the {{#each links}} section.

Feel free to add whatever you'd like to data.yaml, as all of it will be available in the same way in your template.

Happy to add more if need be, or you can close if that takes care of things.

WillJarrettData commented 3 years ago

I think a full list could be useful, if possible! For instance, I wanted to add different pictures for each link but I'm not sure what the key is.

jsoma commented 3 years ago

Apologies if it's not clear - you can add anything you want to the yaml, and it'll be something you can use in the template. For example, right now each link is something like:

links:
  - target: mailto:jonathan.soma@gmail.com
    text: 📧 email
  - target: https://jonathansoma.com
    text: 🏠 homepage

and the links display in home.hbs is:

{{#each links}}
    <li><a href="{{this.target}}">{{ this.text }}</a></li>
{{/each}}

you could change the yaml to something like

links:
  - target: mailto:jonathan.soma@gmail.com
    text: email
    icon: 📧
  - target: https://jonathansoma.com
    text: homepage
    icon: 🏠

and then you'd be able to use icon in the template, like so:

{{#each links}}
    <li><a href="{{this.target}}">{{ this.icon }} {{ this.text }}</a></li>
{{/each}}

There isn't really a "full list" because the list is just "whatever you've put in the yaml"

WillJarrettData commented 3 years ago

Ah right, understood. Thanks!