Having trouble setting/getting slug I am trying to get a certain segment of the url. For this i’m setting the slug as a variable which seems to be best practice:

{% set slug = craft.request.getSegment(2) %}


I am interested in the second segment which is http://example.com/projects/awesome-project where “awesome-project” is the desired part.

I never had any problem with this method but in this case it always returns the first segment (projects), regardless of the passed argument. The site is localized.

I have tried various things but am completely clueless, atm. This can be reproduced with every template.

What could be the culprit?
Got it:

Had already set the slug variable to the first segment in _layout.twig thus overriding everything after. m(