How to add class to the body when user is on particular page? In my case this is “error” page (404/403 etc.)
I should add that I want to do it for .twig
page, not .md
page.
Solved it! In case someone is looking for same solution:
In my base.html.twig
I have:
{% block body %}
<body>
{% endblock %}
In my error page error.html.twig
I defined a class that will be added to the body everytime browser display error page:
{% block body %}
<body class="error-page">
{% endblock %}
And then I target in CSS:
body.error-page {
// your css
}