I'm building an entry type's menu, automatically populated with several sections. A route for dynamic menu had to be also created.
Code
{% set section = craft.sections.getSectionByHandle('sectionHandle') %}
{% set entryTypes = section.getEntryTypes() %}
{% for entryType in entryTypes %}
<li>
<a href="{{ section.handle }}{{ url('types/'~entryType.handle) }}">
{{ entryType.name|ucfirst }}
</a>
</li>
{% endfor %}
Output
- craft.dev/sectionHandle/types/entryType.handle
When I access the link, It gets crazy.
Output
- 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.