I’ve looked through the discource and the doc and no solution seems ideal. Maybe it is time to request a feature?
It is common to use the same partial with both the list.html and single.html template of a type of page. So we don’t have to create too partials whose only difference would be a few characters (class name, link title instead of simple text title etc…).
For this though, it is important to be able to know if the partial is loaded via the single.html template or list.html template.
Maybe a page variable .Template ?
Or just a simple isList / isSingle function built in the template?
.IsPage and .IsNode work in baseof.html but not within a partial.
Within a partial .IsPage always returns true while .IsNode always returns false no matter which template (list.html, single.html) you’re using.
where .template allows me to know if it is an archive or a single.
For now I still have the problem with .IsPage, .pageContext.IsPage always returns true from within the partial. I maybe doing something wrong but cannot pinpoint it as of now.
Without having to pass the template variable to the partial, I could eliminate the dict and simply pass the dot. .Title is way cooler that pageContext.Title or even .dot.Title
It’s a small improvement and may make only sense to me, but I’ve seen this “dict” passing an “is_list” or “template” variable alongside the page context in several themes now and I think many could benefit. Other themes bypass this by creating a post-single partial and a post-list partial but when html looks very much the same, it is rather redundant and error-prone.
No matter what happens: As always, thanks for taking the time!