Your final assignment today is to work with layouts and includes in order to improve the look and feel of your published conference notes. I’m only going to give you the core necessary steps, unleash your creativity and explore options for your style.
Define a new layout
Open up the _layouts directory .
Step 1. Copy the posts layouts to create a new layout.
cp post.html collection-post.html
Step 2. Reuse the html scaffolding
layout: default
Layouts can be nested, so often you have a default to handle the basic html structure, that then delegates to specific types of layout.
Step 3. Update your front matter defaults to use your new layout
- Open _config.yml file
-
Set the defaults.connecttech2018.layout value
defaults: - scope: path: "" type: "connecttech2018" values: layout: "conference-post"
Step 4. Restart Jekyll
Explore And Design Your Perfect Layout
Ideas to get you started.
Add a Track under the post title
<strong>Track:</strong> {{page.track}}
track: Other Tech
Get “Written On” To Show A Date
- What’s up with the “written on” section in the page?
- Does the _posts convention for dates work here?
Replace “Written On” with a list of tags
- Liquid Snippet for displaying tags
{% for t in page.tags %}
<span> {{ t }} </span>
{% endfor %}
Where do you define the tags?
- Post Front Matter
- Add A new object "tags"
- Add values with array syntax
Add Collection Defaults And Track Info
- Add additional variables to your collection definition
collections:
connecttech2018:
output: true
title: Notes from Connect Tech
description: What I learned at Connect Tech!
Where is this?
_config.yml Working locally? Don't forget to restart!
- Before post content add a new section to display the default properties
<div>
{% assign current_collection = site.collections | where: "label", page.collection | first %}
<h4> {{ current_collection.title }} </h4>
{{ current_collection.description }}
</div>
Why do I have to filter where by first?
The where always returns and array, even of just one item. If you don't also ask for the first item, you'll get weird results. (I did mention that Liquid is verbose!)