Hiding Posts from the Homepage in Jekyll (Minima Theme)

If you’re using the default minima theme in Jekyll, your homepage is powered by the home.html layout. By default, it loops through all posts and lists them.

Sometimes you might want certain posts to exist (have a URL) but not show up on your homepage. Here’s how to do it.


1. Locate home.html

Inside your project, you should have:

_layouts/home.html

If you don’t, create an _layouts/ folder and copy the theme’s home.html into it. This lets you override the theme defaults.

The important section looks like this:


{%- for post in site.posts -%}
  <li>
    {%- assign date_format = site.minima.date_format | default: "%b %-d, %Y" -%}
    <span class="post-meta">{{ post.date | date: date_format }}</span>
    <h3>
      <a class="post-link" href="{{ post.url | relative_url }}">
        {{ post.title | escape }}
      </a>
    </h3>
    {%- if site.show_excerpts -%}
      {{ post.excerpt }}
    {%- endif -%}
  </li>
{%- endfor -%}


2. Modify the Loop to Skip Hidden Posts

Wrap the loop contents in an unless condition:


{%- for post in site.posts -%}
  {%- unless post.exclude_from_home -%}
    <li>
      {%- assign date_format = site.minima.date_format | default: "%b %-d, %Y" -%}
      <span class="post-meta">{{ post.date | date: date_format }}</span>
      <h3>
        <a class="post-link" href="{{ post.url | relative_url }}">
          {{ post.title | escape }}
        </a>
      </h3>
      {%- if site.show_excerpts -%}
        {{ post.excerpt }}
      {%- endif -%}
    </li>
  {%- endunless -%}
{%- endfor -%}


3. Mark Posts to Be Hidden

In any post you want to hide from the homepage, add this to the front matter:

---
title: "My Hidden Post"
date: 2025-08-23
exclude_from_home: true
---

Result

  • The post is still built and available at its URL.\
  • It will not appear in your homepage list of posts.

This is useful for things like notes, drafts, or special pages you don’t want on your main feed.

Visit Emlekezik.com