Skip to main content

Settings

Color Mode

Theme Skin

Background

Appearance preferences are saved in this browser only.

Environment

Current Environment Dev

Built with JEKYLL_ENV=development. Changes auto-reload under jekyll serve.

Theme & Build

Jekyll v3.10.0
Last BuildSep 13, 02:04

Page Location

Page Info

Layout default
Collection docs
Path _docs/customization/layouts.md
URL /docs/customization/layouts/
Date 2026-09-13

Layouts

Create and customize page layouts in the Zer0-Mistakes Jekyll theme.

Layouts

Layouts define the structure and appearance of your pages. The Zer0-Mistakes theme includes several built-in layouts.

Available Layouts

Layout Purpose Use Case
default Standard page with sidebar Documentation, general pages
article Blog post layout Blog posts with metadata
home Homepage layout Site homepage
collection Collection index Listing pages for collections
landing Full-width page Marketing/landing pages
root Base HTML Don’t use directly

Using Layouts

Specify a layout in your page’s front matter:

---
title: "My Page"
layout: default
---

Layout Hierarchy

Layouts inherit from each other:

root.html                 # base HTML document — never use directly
├── default.html          # adds the sidebars and table of contents
│   ├── article.html      # blog posts
│   ├── collection.html   # collection index pages
│   ├── author.html  authors.html
│   ├── note.html    notebook.html
│   ├── recipe.html  cookbook.html
│   └── tag.html
├── home.html             # homepage
├── landing.html          # full-width marketing pages
├── section.html  news.html  admin.html  stats.html
└── 404.html      setup.html  welcome.html  book*.html

Which branch a layout sits on is not cosmetic. default.html is the only layout that renders the left sidebar (#bdSidebar) and the table-of-contents panel (#tocContents). A layout inheriting root directly gets neither — so a custom layout that needs them should inherit default.

Creating Custom Layouts

Step 1: Create the Layout File

Create a file in _layouts/:

---
layout: default
---
<!-- _layouts/tutorial.html -->
<article class="tutorial">
  <header class="tutorial-header">
    <h1>{{ page.title }}</h1>
    <div class="meta">
      <span class="difficulty">{{ page.difficulty }}</span>
      <span class="time">{{ page.estimated_time }}</span>
    </div>
  </header>
  
  <div class="tutorial-content">
    {{ content }}
  </div>
  
  {% if page.next_tutorial %}
  <footer class="tutorial-footer">
    <a href="{{ page.next_tutorial }}">Next Tutorial →</a>
  </footer>
  {% endif %}
</article>

Step 2: Use the Layout

---
title: "Getting Started Tutorial"
layout: tutorial
difficulty: beginner
estimated_reading_time: "15 minutes"
next_tutorial: /tutorials/part-2/
---

Layout Variables

Access these variables in your layouts:

Variable Description
{{ content }} Page content (required)
{{ page.title }} Page title
{{ page.description }} Page description
{{ page.layout }} Current layout name
{{ page.url }} Page URL
{{ site.title }} Site title

Overriding Theme Layouts

To customize a theme layout:

  1. Copy the layout from the theme to your _layouts/ directory
  2. Modify as needed
  3. Jekyll uses your version instead

Conditional Content

Show content based on layout or page variables:

{% if page.layout == 'article' %}
  <div class="post-meta">
    <time>{{ page.date | date: "%B %d, %Y" }}</time>
    <span class="author">{{ page.author }}</span>
  </div>
{% endif %}

{% if page.sidebar %}
  {% include navigation/sidebar.html %}
{% endif %}

Including Components

Use includes for reusable parts:

{% include core/head.html %}
{% include navigation/header.html %}
{% include content/toc.html %}
{% include core/footer.html %}

Best Practices

  1. Start with default — Inherit from default for consistency
  2. Keep layouts focused — Each layout should have one purpose
  3. Use includes — Extract reusable components
  4. Document custom layouts — Note purpose and required variables
  5. Test responsiveness — Verify layouts work on all screen sizes

Reference

Technical Reference

For contributor-level details (layout hierarchy, Liquid template inheritance, sidebar wiring):

See also

  • [[Customization]]
  • [[Include Components]]
  • [[Liquid]]