Answers.Body: <p>Since you are building a custom URL, you shouldn't be using <a href="http://buildwithcraft.com/docs/templating/functions#url" rel="nofollow"><code>url()</code></a> here, since it automatically appends your values to the <code>siteUrl</code>. Try one of these instead:</p>
  
  <p><code>&lt;a href="{{ url(section.handle ~ '/types/' ~ entryType.handle) }}"&gt;</code></p>
  
  <p>-or-</p>
  
  <p><code>&lt;a href="{{ siteUrl ~ section.handle ~ '/types/' ~ entryType.handle }}"&gt;</code></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-13T07:43:07.353Z
Answers.Text: Have tried it before. And with the same effect. I keep looking for the root of a problem.
Answers.UserDisplayName: Dominik Krulak
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-13T07:46:25.010Z
Answers.Text: 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>` ?
Answers.UserDisplayName: Dominik Krulak
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-13T19:24:26.213Z
Answers.Text: That should work! I updated my answer to include your solution and another using `siteUrl`
Answers.UserDisplayName: Aaron Berkowitz
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-04-12T20:19:03.757Z
Answers.LastActivityDate: 2015-04-13T19:24:02.683Z
Answers.LastEditDate: 2015-04-13T19:24:02.683Z
Answers.UserDisplayName: Aaron Berkowitz
Body: <p>I'm building an entry type's menu, automatically populated with several sections. A route for dynamic menu had to be also created.</p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>{% set section = craft.sections.getSectionByHandle('sectionHandle') %}
  {% set entryTypes = section.getEntryTypes() %}
  
  {% for entryType in entryTypes %}
      &lt;li&gt;
          &lt;a href="{{ section.handle }}{{ url('types/'~entryType.handle) }}"&gt;
              {{ entryType.name|ucfirst }}
          &lt;/a&gt;
      &lt;/li&gt;
  {% endfor %}
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <ul>
  <li>craft.dev/sectionHandle/types/entryType.handle</li>
  </ul>
  
  <p>When I access the link, It gets crazy.</p>
  
  <p><strong>Output</strong></p>
  
  <ul>
  <li>craft.dev/sectionHandle/types/sectionHandle/types/entryType.handle</li>
  </ul>
  
  <p>I was trying everything I know, but Whatever I add in front of <code>{{url('types/'~entryType.handle) }}</code>, it gets duplicated.</p>
  
Tags: <url>
Title: How do I build a link from variables?
ThreadText: # How do I build a link from variables?
  
  (Asked by: username_0 on 2015-04-12)
  
  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.
  
  **Tags:** url
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-04-12. Score: 5 | Accepted answer
  
  Since you are building a custom URL, you shouldn't be using [`url()`](http://buildwithcraft.com/docs/templating/functions#url) here, since it automatically appends your values to the `siteUrl`. Try one of these instead:
  
  `<a href="{{ url(section.handle ~ '/types/' ~ entryType.handle) }}">`
  
  -or-
  
  `<a href="{{ siteUrl ~ section.handle ~ '/types/' ~ entryType.handle }}">`
  
  > **Comments:**
  > **username_0**: Have tried it before. And with the same effect. I keep looking for the root of a problem.  
  > **username_0**: 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>` ?  
  > **username_1**: That should work! I updated my answer to include your solution and another using `siteUrl`  
  
  ---
  
  