Multiple layouts for same content

There are at least a couple of ways to do this. Here’s one that’s somewhat easy to wrap your head around…

git clone --single-branch -b hugo-forum-topic-37238 https://github.com/jmooring/hugo-testing hugo-forum-topic-37238
cd hugo-forum-topic-37238
hugo server

structure

content
├── talks/
│   ├── talk-1/
│   │   ├── fancy.md 
│   │   └── _index.md  <-- this has the content
│   └── talk-2/
│       ├── fancy.md
│       └── _index.md  <-- this has the content
└── _index.md

templates

layouts/talks/
├── single-fancy.html
└── single.html

The trick is to set the layout value in front matter. Please clone the repository for details.

2 Likes