Creating a Layout for Content with multiple Subfolders?

To remove “posts” from the permalinks…

content structure
content/
├── posts/
│   ├── section-1/
│   │   ├── section-1-1/
│   │   │   ├── _index.md
│   │   │   ├── a.md
│   │   │   └── b.md
│   │   ├── section-1-2/
│   │   │   ├── _index.md
│   │   │   ├── c.md
│   │   │   └── d.md
│   │   └── _index.md
│   ├── section-2/
│   │   ├── section-2-1/
│   │   │   ├── _index.md
│   │   │   ├── e.md
│   │   │   └── f.md
│   │   ├── section-2-2/
│   │   │   ├── _index.md
│   │   │   ├── g.md
│   │   │   └── h.md
│   │   └── _index.md
│   └── _index.md
└── _index.md

site configuration
[permalinks.page]
posts = '/:sections[1:]/:slug/'
[permalinks.section]
posts = '/:sections[1:]/'

content/posts/_index.md
+++
title = 'Posts'
date = 2023-08-06T07:56:11-07:00
draft = false
[_build]
render = 'never'
list = 'never'
+++

published site
public/
├── section-1/
│   ├── section-1-1/
│   │   ├── a/
│   │   │   └── index.html
│   │   ├── b/
│   │   │   └── index.html
│   │   └── index.html
│   ├── section-1-2/
│   │   ├── c/
│   │   │   └── index.html
│   │   ├── d/
│   │   │   └── index.html
│   │   └── index.html
│   └── index.html
├── section-2/
│   ├── section-2-1/
│   │   ├── e/
│   │   │   └── index.html
│   │   ├── f/
│   │   │   └── index.html
│   │   └── index.html
│   ├── section-2-2/
│   │   ├── g/
│   │   │   └── index.html
│   │   ├── h/
│   │   │   └── index.html
│   │   └── index.html
│   └── index.html
├── favicon.ico
└── index.html

2 Likes