Unit 04 · lesson

Collection Documents and Output

Your project files exist.

Now make the generated pages intentional.

Build a project layout

Create or refine:

_layouts/project.html

Example:

---
layout: default
---
<article>
  <h1>{{ page.title }}</h1>
  <p>{{ page.summary }}</p>
  {{ content }}
</article>

Avoid repeating the layout key

You will learn front-matter defaults deeply in Unit 6, but you can already recognize the problem:

If every project repeats:

layout: project

that may be a candidate for a collection default later.

Do not prematurely copy configuration you do not understand.

Build a project index

{% for project in site.projects %}
  <article>
    <h2><a href="{{ project.url | relative_url }}">{{ project.title }}</a></h2>
    <p>{{ project.summary }}</p>
  </article>
{% endfor %}

Inspect generated URLs

Record:

Project sourceproject.urlGenerated file

Then decide whether the default URL structure is acceptable or whether collection permalinks should change later.

Checkpoint

Prove one project page combines:

  • collection document front matter;
  • Markdown body;
  • project layout;
  • default layout;
  • generated public URL.