I need to add the name of each category to the body class. I have searched for a way to dump the variable for the category name inside of the template.master file with no luck. I can get the page name or meta info but not the category name.
So it would be
<body class="mycategory">
My styling on the whole page (even outside of the entity.category.xml.config) will be affected by this class.
Update: So an example structure on the site would be Clothing > Men > Brand 1 > product 1. I want a a class that shows up for the whole clothing section regardless if I am on a a product, sub category, or sub-sub category.
Start with this in your master file:
Then create an xml package named bodyclass.xml.config. In that file add this:
This will create classes like e-category-53 rather than category name, but they will give you the same flexibility. They will also work for other entity types like sections and manufacturers.
Another useful one here is:
This will generate a body class based on the url like 'url-c-88-sename'. This will apply to ALL pages, not just entity pages.