Up until now I’ve been using page ID’s to assign classes to the page body that I can then control in CSS (I am adjusting things like the background image depending on the website page). This is working fine except for any second level page that has multiple articles, so for example the projects page is find as I can just use the element ‘body.projects’ in my class, but for any projects articles this is an issue as the ID will be the name of the article.
<body class="<?= $page->uid() ?>">
Is there a way to find if the word ‘projects’ is used in the url and then assign the projects class or for any article page to assign the parent page id? Or another way around it that I’m not thinking of?