Blog posts don't appear in Jekyll

Redirected from here: https://github.com/mmistakes/minimal-mistakes/issues/1493

The index.html contains the front matter:

---
layout: home
author_profile: true
permalink: /blog
---

Therefore the home layout should be available at /blog. I am moving the home layout to /blog because I want to use my own HTML file for index.html (as the first page the user sees when they visit my website)

–>

Steps to reproduce the behavior

https://github.com/brandonskerritt/brandonskerritt.github.io

I cloned the repo, changed _config.yml to include _posts. I then took index.html which had the original front matter

---
layout: home
author_profile: true
---

and change it so it has a permalink attribute

---
layout: home
author_profile: true
permalink: /blog
---

I also moved this file into _pages and added _pages to _config.yml

There is a 404 on my page at “brandonskerritt.github.io/” which is expected, but when i visit /blog it shows me the home layout but with no posts on it, despite there previously being posts when the index.html file was at /

Note: I want to have my own HTML file (to use as a personal portfolio) on / but I want to be able to access my blog posts from /blog

There is no compilation error.

Screenshot of /blog
https://screenshots.firefox.com/mk3PnBv27Vu5si3H/brandonskerritt.github.io
Note: when the permalink is removed and index.html is moved to the outer folder it shows blog posts, which leads me to believe I don’t understand something about this theme.

My question is: How do I show my blog posts at /blog and have index.html be my own custom HTML file?

Your /blog page isn’t showing posts because it is trying to use Jekyll pagination. I’m pretty sure that only works on the root “home” index.html and not in a subfolder.

If you want /blog to be an index of all your posts then you’ll have to switch from layout: home as that loops through the pagination object. You’ll want to use layout: archive instead and a for loop similar to this page.

---
layout: archive
---

<h3 class="archive__subtitle">Posts</h3>

{% for post in site.posts %}
  {% include archive-single.html %}
{% endfor %}
1 Like