Want to add class name using collection url

Hello,

Try to replace the conditional with this:

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

{% if pageUrl contains “?sort_by=created-descending” %}
-----your stuff here----
{% endif %}

I hope it works!

1 Like