Different layout for a specific taxonomy term value

Hello everyone!

On my website I use taxonomy grouping based on the solution in this thread. By the way, once again many thanks to jmooring, you’re awesome. :slight_smile:

Everything works great.

There’s a question, though. I’m not sure if it’s possible, so could please anyone clarify it for me.

I have a taxonomy term “series” for posting series of short stories. Currently there are three values to this term (three series). Pages on the list get sorted by weight.

What I’m trying to achieve. One of the series is called “Microfiction” for posting super short stories. It has lots of content pages listed under it due to its nature. So I’d like for the content in this series to be listed on its dedicated term page in reverse chronological order (latest first, like blog) and grouped by month or year. The rest of normal series should stay the ways they are, sorted by weight.

So, what I’d like to know is whether it is possible to have a different condition/design for one particular taxonomy term value. Can there be a separate layout for a particular value of a term (something like its own term.html list layout)? Or maybe an “if” condition in the group-by-term.html layout (if the “series” term value is “microfiction”, fetch titles this way, else fetch them another way)?

Many thanks in advance!

content/series/series-1/_index.md

+++
title = 'Series One'
date = 2023-06-09T13:27:05-07:00
draft = false
weight = 1
layout = 'series-1'
+++
layouts/
├── _default/
│   ├── baseof.html
│   ├── home.html
│   ├── list.html
│   └── single.html
├── series/
│   ├── series-1.html    <-- custom list page for series-1
│   ├── taxonomy.html
│   └── term.html
└── writing/
    ├── group-by-term.html
    ├── list.html
    └── single.html

2 Likes

Thank you, Joe! Turns out it’s very easy. :slight_smile:

Just to make sure I understand how it works. Basically, I can have any page rendered with a custom template, if I put such template into the relevant place (where the default template of its kind resides, in accordance with the lookup order) and add the name of this template into the given .md front matter. Right?

If so, then it’s very convenient and allows for a flexibility I didn’t even suspect. :slight_smile:

Thank you again, you are helping a lot. :slight_smile:

1 Like

Correct.

1 Like

Thank you! :slight_smile:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.