How can I create an if-else state for multiple page IDs?

Can anyone help me with this? I want to create an if-else state for page ID just like this one below -

{% if page.id == XXXXX %}

CSS HERE

{%else%}

CSS HERE

{% endif %}

But there are multiple page IDs for the first condition, how should I do it?

1 Like

Hi @LuffyDMonkey12

you can try

{% if page.id == XXXXX or page.id == XXXXY or page.id == XXXXZ %}

 CSS HERE

{%else%}

CSS HERE

{% endif %}

Hope my solution works perfectly for you.

Cheers!

Oliver | PageFly

2 Likes

replied to wrong comment

{% assign page_ids = ‘ID1,ID2,ID3’ | split: ‘,’ %}

{% if page_ids contains page.id %}

.css { }

{% else %}

.css { }

{% endif %}

1 Like