Last active
August 29, 2015 14:17
-
-
Save keithmancuso/58347c0e886e382bdd26 to your computer and use it in GitHub Desktop.
City switcher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set newUrl = '' %} | |
{% for segment in craft.request.getSegments() %} | |
{% if loop.index == 1 %} | |
{% set newUrl = newUrl ~'/'~ city %} | |
{% else %} | |
{% set newUrl = newUrl ~'/'~ segment %} | |
{% endif %} | |
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set segments = craft.request.getSegments() %} | |
{% set newUrl = segments[2:segments|length] %} | |
{% set newUrl = city.slug ~ newUrl %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment