Use baseof from another section for a taxonomy

I have a taxonomy, tags, that is only ever associated with posts. posts has its own baseof.html. I’m trying to figure out how to get the tags to inherit the baseof from posts.
So given the following folder structure:

layout/
└── _default/
    └── baseof.html
└── posts/
    ├── baseof.html
    ├── tags.html (desired)
    └── terms.html (desired)
└── tags/
    └── taxonomy.html
    └── terms.html

I would like tags to use the posts baseof. What I’ve tried so far is to create a new content/tags/_index.md with layout: posts. Doing this picks up layout/posts/terms.html for /tags with the correct posts/baseof.html, however /tags/foo falls back to layout/tags/taxonomy.html with the _default/baseof.html.

I have also tried setting up permalinks like tags = '/tags/:slug' - this did not appear to do anything.

I have also tried doing a cascade, but that also did not appear to do anything.

So is it possible for the tags taxonomy to use this other, non-default, template?

If it’s not, I did see I can set my own baseof.html in tags/baseof.html which would work, just leads to duplicate logic / code.

layouts/
├── _default/
│   ├── baseof.html
│   ├── home.html
│   ├── list.html
│   └── single.html
└── posts/
    ├── baseof.html
    ├── taxonomy.html
    └── term.html
content/
├── posts/
│   └── post-1.md
├── tags/
│   └── _index.md
└── _index.md

content/tags/_index.md

+++
title = 'Tags'
date = 2023-06-24T15:01:30-07:00
draft = false
[[cascade]]
type = 'posts'
+++

Just make sure that, when building a “posts” page collection, you compare “Section” instead of “Type”.

I was so close! That worked perfectly, thank you very much.

Just make sure that, when building a “posts” page collection, you compare “Section” instead of “Type”.

For future readers, this works:

{{ define "content" }}
<ul>
    {{ range (where .Pages "Section" "tags") }}
        <li>{{ .Title }}</li>
    {{ end }}
</ul>
{{ end }}
1 Like

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