Can I have different CSS for a folder/subfolder?

Context: I want to set up Obsidian Publish for one folder and its subfolders. The published notes will remain an important part of my own notes, but I will have different standards for how I edit them.

Want: So I want see instantly if a note is in the published folder. So if I follow a link from another note and now I’m looking at a published note, it has a different background colour.

Question: Can I make notes in one folder look different from the rest of the vault? With CSS?

Or is there another solution to avoid confusing published from unpublished notes?

Note: I can open the subfolder as a vault (nested vaults, which are unsupported/discouraged). That will allow me to apply a different CSS. But this only works if I deliberately open the other vault, which largely defeats the point.

Thanks!

Things I have tried

I’ve searched through the forum and on Google but can’t find anything. Maybe I need better search terms.

You could use the cssclass: YAML header on each note you want to differentiate:

https://help.obsidian.md/Advanced+topics/YAML+front+matter

CSS for specific pages

1 Like

Thanks. I’m hoping for something automatic for any note in the folder.

But if it’s impossible, this could be the next best thing. I would have the text saved to my clipper app. And I’d need to regularly check for any note in that folder that lacks that header (probably have a script that runs daily and alerts me if needed).

1 Like

I can’t think of any solutions that don’t require some kind of manual or semiautomatic differentiation, unfortunately.

Another hacky option might be to use some symbol or prefix in the note title and then use a CSS link data attribute selector (that might not be the right term) to colour the note in the file explorer.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.