Custom text at top of category pages

I’m using category pages for the movies and TV shows that I log on my blog. Is it possible to add a paragraph of custom text for a short description at the top of these pages? The text will be different depending on the category page.

I’m using a custom theme and can edit my templates.

Yes. For example, my Now page is constructed by using the default page for categories and saying if the category is now, do something different (in my case, show only the most recent post).

So I don’t have a term.html page under defaults. But based on some reading, I assume /_defaults/single.html is the base template for category pages. So basically, can I add an if-statement at the top to display text “XYZ” if Category=X or text “ABC” if Category=Y and so on? Then let the rest of the page display whatever the category page is supposed to display.

/_default/single.html is definitely not the default for a category page. If anything, it’d be /_defaul/list.html. I would just make layouts/_default/term.html– the only thing you should have to do is {{define "main" }} {{ end }} to work with a modern baseof template with a main block.

Defining the term page is a great way to not clobber other things that may be using the list page type.

Also, while I’m super happy to answer this question here, for others that are reading, this the kind of question that searching or posting on the Hugo forums is almost certainly going to yield more, better, and faster answers. None of this is specific-- it’s all just “how do you do this in Hugo?”.

It’s also a question that ChatGPT does exceptionally well (although it’s answer in this case is actually something that is slightly harder to do on, it’s actually quite good):

The only thing you’d have to do different for is that you have to create the content/categories/ page from your custom design page and not where you do posts/content, but this can, in fact, be done.

ChatGPT even got this right though I typed “block” instead of “blog” (autocorrect error).

In this post you recently made, presumably in response to my question here, I had previously assumed was based on Hugo, but whenever I searched things on Hugo forums and applied it here, I was told yes, but does it differently. Maybe things have changed now, but I searched through the archives at Help first and found one of your posts asking about the differences.

Anyway, I’m mostly stumbling through and finding out things by trial-n-error. The ChatGPT link helped. Thanks!