Do something, when there is a special part in the URL

Hello!

I am searching for a possibility that Hugo do something, when there is a special part in the URL.

When “paris” is inside URL (www.france.fr/paris/buildings/etc/), then do something (eg underline Link by setting active class).

Have u any idea?

Try

{{ if strings.Contains .Permalink "paris" }}

OR
{{ if in .Permalink "paris" }}

Where .Permalink you can also use .RelPermalink if you want.

Thank you so much! That works, but I realized that I need the other way with “not contain”? Is that possible?

Edit: Forgot it, I have to go deeper in that problem. Thank you for your help!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.