I'm new to twig and drupal 8 and finding it hard to access page titles. I want to apply a class to a page title on certain pages, all of which share a sub-directory in the URL path. I'm working with a page-title.html.twig file and want to do something like this:
{{ title_prefix }}
{% if title %}
{% if <url contains "/services/"> %}
<h1 {{ title_attributes.addClass('services-title') }}>{{ title }}</h1>
{% else %}
<h1 {{ title_attributes.addClass('page-title') }}>{{ title }}</h1>
{% endif %}
{% endif %}
{{ title_suffix }}
I'm assuming this is possible, I just can't figure out how to check the URL for the desired string.