I'm building an entry type's menu, automatically populated with several sections. A route for dynamic menu had to be also created.


{% set section = craft.sections.getSectionByHandle('sectionHandle') %}
{% set entryTypes = section.getEntryTypes() %}

{% for entryType in entryTypes %}
        <a href="{{ section.handle }}{{ url('types/'~entryType.handle) }}">
            {{ entryType.name|ucfirst }}
{% endfor %}


  • craft.dev/sectionHandle/types/entryType.handle

When I access the link, It gets crazy.


  • craft.dev/sectionHandle/types/sectionHandle/types/entryType.handle

I was trying everything I know, but Whatever I add in front of {{url('types/'~entryType.handle) }}, it gets duplicated.

1 Answer 1


Since you are building a custom URL, you shouldn't be using url() here, since it automatically appends your values to the siteUrl. Try one of these instead:

<a href="{{ url(section.handle ~ '/types/' ~ entryType.handle) }}">


<a href="{{ siteUrl ~ section.handle ~ '/types/' ~ entryType.handle }}">

  • Have tried it before. And with the same effect. I keep looking for the root of a problem. Apr 13, 2015 at 7:43
  • Well, just after I posted my last comment, I think I've fixed it. I don't know, if it's correct, but it seems to be working. <a href="{{ url(section.handle ~ '/types/' ~ entryType.handle) }}">{{ entryType.name|ucfirst }}</a> ? Apr 13, 2015 at 7:46
  • That should work! I updated my answer to include your solution and another using siteUrl Apr 13, 2015 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.