Can I use not contain in filter page url?

Hello,

I have some questions want to ask, I would really appreciate it if someone can tell me how to solve this problem.

There are Operators like == , != , contains that can be use in {% if page.url %}

If I want to control pages which url specific equal to ’ /pages/skincare’, I can use {% if page.url != ‘/pages/skincare’ %}

However, if I want to control all pages which url contains without ‘abc’, how can I do?

Can I use {% if page.url not contains ‘abc’ %}

What I want to do is
I have some pages - about-us, brand-news, product-name-1, product-name-2, … etc and pages contain specific name skincare-about-us, skincare-product-name-1 , skincare-product-name-1… etc.
I want css use only in page url not contains skincare, how can I do ?

Thank you

hi you can use

{% if page.handle contains “skincare-about-us” %}

{% endif %}

you can use fo templated if there is same template

{% if template contains 'collection'  %} 

{% endif %}

also there are other ways

https://cheat.markdunkley.com/

Hi ,

I can say that there is no excluded operator in it:
https://shopify.dev/docs/api/liquid/basics#operators

The following may be useful:

{%- capture querystring -%}{{ content_for_header }}{%- endcapture -%}
{%- assign pageURL = querystring | split:‘“pageurl”:"’ | last | split:‘"’ | first | split:‘.myshopify.com’ | last | replace:‘/’,‘/’ | replace:‘%20’,’ ’ | replace:‘\u0026’,‘&’ -%}

{% if pageURL contains “abc” %}
console.log(‘link: {{pageURL}}’);
{% endif %}