About categories and posts

Photo of the author, Morgan Feeney

Morgan Feeney

1 min read

Learn how to display the child posts or child categories on a blog page.

Directory structure

The directory structure for posts and categories is very simple, allow me to illustrate:

blog/
├─ category/
│  ├─ index.mdx
│  ├─ post.mdx
│  ├─ category/
│     ├─ index.mdx
│     ├─ post.mdx
├─ index.mdx

Visibility of child categories and posts

In any index.mdx file you'll see the following autogenerated frontmatter:

---
title: Mdx
date: 2023-11-15
show_child_posts: true
description: "Add a description"
---

If you look at line 4 you'll see that child post visibility is enabled by default. Change the value to false to show child categories instead of the child posts.