Key for determining if a post is on an index page, or displayed on its own?
On pages where multiple posts are displayed, the <h1> is the page name, e.g.: Archives, Home. Posts titled are rendered in <h2>. On a single post page, the post title is an <h1> tag and subheadings are <h2>, <h3>, etc as needed. All good so far.
The issue arises when a post with subheadings is not displayed on its own page, e.g.: when shown on a page showing the ten most recent posts in full. There, the titles are rendered in <h2>, but then the subheadings are one level off.
My thought was to write the headings within each post something like:
{{{#singleentry}}}h2{{{/singleentry}}} {{{#multientries}}}h3{{{/multientries}}}
But I am not sure what the appropriate key would be, if it exists. I had a look through the developer reference doc but didn't see something like this.
Since something like this would be useful for things beyond just modifying heading levels, I feel like there must be something that will do the trick that I am simply not seeing.
If there's a better way, I'm all ears!
You can check whether the post is both the first and last item, i.e. the only item, like so:
{{#entries}}
{{#first}}{{#last}}
...this is the only entry on the page...
{{/last}}{{/first}}
{{/entries}}
Does that help?