CSS class on Body tag to distinguish homepage / non-category page

I had mentioned this in another topic, but thought I’d be more direct :blush:

Could a class be added to the body tag of the homepage (and perhaps to all non-category pages)? I couldnt figure out how to target CSS only to be applied to the homepage or non category pages

ie BODY class=latesthome global

(If no category identified, the global class gets added)

Its particularly useful for backgrounds. Categories of course have the baked in background feature, but to apply backgrounds for other screens, we depend on css. It also means for inner pages, we are loading our global background unnecessarily.

Perhaps there’s already some way of achieving what I’m describing, in a cleaner way?


I believe @techapj worked on something related to this recently.


This was recently done via:


Currently there is no identifier (unique class) for /latest, /new, /unread & /top pages. I will add that and notify here.


Very cool @techAPJ. What do you think of the suggesting of adding a catch all “global” class as well, when there is no category defined. This can be an easy way to set a background (for example) for all pages that don’t belong to a category, without having to identify every single one .

I don’t think there would be that many of them where using a comma separated list would be that much trouble.

But a “global” class would be easier.

If it’s going to be done I guess now while that area of code is being worked on would be the opportune time to do it.

Think as I might, ATM the best I can come up with as a descriptive value is “non-category”. It just feels to me that there should be something, anything better than that, but I got nothing.

1 Like

Thx for considering the suggestion. Other ideas for the class name. I am ultimately indifferent :wink:


Added navigation-topics class to above mentioned pages (via this commit).

This will be tricky to implement. The better solution IMO is to assign a unique class to a page (or set of pages).


Thx @techAPJ!

I mentioned the no-category class, thinking that the DFP plugin has a unique variable of 0 that it uses for all pages that don’t have an associated category. So I assumed that the same logic could be applied.

Sorry to revive an ancient topic, but does this class still exist? I can’t seem to find a CSS selector for /latest /top, etc. Thanks!

Hi David,

Yes, .navigation-topics is a body class and still available. :slightly_smiling_face:

1 Like