I’ve got my taxonomy working pretty well:
This works like a champ no problem. However, I am showing a thumbnail in this view, and I want to enable the user to click on it to get the full picture. So essentially creating a picture viewer for this taxonomy term:
How does one go about doing this? The closest I have found is to create a
/content/authors/detail/<id>/_index.md in the root, but this seems cumbersome. I am also creating a theme and would like to keep this generalized without forcing end users to create their own directory structure for basic/expected functionality, if that makes sense.
Is this possible? Thank you in advance for any assistance you can provide.
There seems to be two questions here:
- How to add Data to taxonomies without Front Matter (
- How to create an extra HTML page (detail) alongside the default one.
1. How to add Data to taxonomies without Front Matter (
You could have a data file named after your taxonomy term’s id. I’m not sure if it would make easier for your theme users to maintain, but it keeps you out of the Front Matter structure.
Then, from your templates, you’d have to grab the right data file and content using the taxonomy term ID.
2. How to create an extra HTML page alongside the default one.
You will need to add a new custom output format. Call it
detail for example, and have it use the
HTML media type. Then create a template for it and set it on your
Checkout the doc I think it has everything you need to do the preceding.
You might need to use some sort of url rewriting mechanism to have this output format served at the wished… (rather than `/authors//detail.html)
Hi @regis thank you for your assistance! It is much appreciated.
I also apologize if I didn’t describe this in enough detail or caused confusion here. What I am looking to achieve is to simply create another view with the same data.
Right now I have the primary view rendering exactly as desired from
themes/<theme>/layouts/authors/author.html. In this file, I have a link to
/authors/detail/<id> that shows the same information, but in a different view:
However, the only way that I can see doing that is via front matter and
_index.md as described earlier (with a
type parameter defined in it).
I did see the use of output types being used for template resolution. I will look further into this to see if that is what I am looking for here. Thank you for the link.
@regis you are my hero! Very nice lead here. It took me a while to grok the output types but I was able to make it work.
To start, after more research, I determined that what I was looking for was nested/subsection templates, which is not available.
So what I did was configure my
And then create a
Boom. I now have /authors//detail/ created for all authors! However, at this point, all taxonomy terms have a detail. No matter, I then created a
/taxonomy/taxonomy.details.html which simply includes my 404 message, which I also extracted to a partial.
(pardon my French here)
Much appreciated! Very clever trick to keep around while developing with this amazing tech.
That’s great to hear!
I love reading about a good output format use case
See you around!