Answers.Body: <p>The browser reads <code>user.userWebsite</code> as a relative URL, not an absolute one, I guess because your <code>user.userWebsite</code> field does not store the protocol, i.e.: http or https. </p>
  
  <p>If you don't specify a protocol in a URL a browser <em>must</em> assume that it is a link to a resource on your own site. The solution is to either store the protocol within userWebsite (probably the best option), or prepend it in your template, e.g.:</p>
  
  <p><code>href="https://{{ user.userWebsite }}"</code></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-22T15:16:50.377Z
Answers.Text: I'd recommend prepending it in the template, and doing a find/replace to account for users who may include the protocol. For example, If a user enters "https://..." or "http://..." in your field you'll end up with repeating protocols. This will replace both protocols and output correctly: href="https://{{ user.userWebsite|replace({ 'https://': '', 'http://', '' }) }}" If the protocol is not entered, there will be no replacement, just your field content. This method ensures that you'll always get the secure protocol in your links.
Answers.UserDisplayName: Vaughn D. Taylor
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-18T13:53:04.313Z
Answers.LastActivityDate: 2018-12-18T13:53:04.313Z
Answers.UserDisplayName: Seth Warburton
Body: <p>I have links on a partial within my templates, but it seems to be trying to load a template when it should just be loading the outbound href of the <code>&lt;a&gt;</code> tag. I don't have a clue why this would be happening?</p>
  
  <pre><code>  {% if user.userWebsite %}
    &lt;li class="list-inline-item m-1"&gt;
      &lt;a class="btn btn-light" href="{{ user.userWebsite }}" target="_blank"&gt;&lt;i class='bx bx-rss bx-tiny'&gt;&lt;/i&gt;&lt;/a&gt;
    &lt;/li&gt;
    {% endif %}
  </code></pre>
  
  <p>Will link out to <code>mysite.com/profile/pinterest.com/username</code> when really it should be going to <code>pinterest.com/username</code></p>
  
  <p>Any ideas to why?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-12-16T14:03:29.090Z
Comments.Text: Have you checked the links have an http or https at the start of them?
Comments.UserDisplayName: James Greig
Tags: <templating>
Title: Partial links not going outbound
ThreadText: # Partial links not going outbound
  
  (Asked by: username_0 on 2018-12-16)
  
  I have links on a partial within my templates, but it seems to be trying to load a template when it should just be loading the outbound href of the `<a>` tag. I don't have a clue why this would be happening?
  
  ```
    {% if user.userWebsite %}
    <li class="list-inline-item m-1">
      <a class="btn btn-light" href="{{ user.userWebsite }}" target="_blank"><i class='bx bx-rss bx-tiny'></i></a>
    </li>
    {% endif %}
  
  ```
  
  Will link out to `mysite.com/profile/pinterest.com/username` when really it should be going to `pinterest.com/username`
  
  Any ideas to why?
  
  **Tags:** templating
  
  > **Comments:**
  > **username_1**: Have you checked the links have an http or https at the start of them?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-12-18. Score: 1
  
  The browser reads `user.userWebsite` as a relative URL, not an absolute one, I guess because your `user.userWebsite` field does not store the protocol, i.e.: http or https.
  
  If you don't specify a protocol in a URL a browser *must* assume that it is a link to a resource on your own site. The solution is to either store the protocol within userWebsite (probably the best option), or prepend it in your template, e.g.:
  
  `href="https://{{ user.userWebsite }}"`
  
  > **Comments:**
  > **username_3**: I'd recommend prepending it in the template, and doing a find/replace to account for users who may include the protocol. For example, If a user enters "https://..." or "http://..." in your field you'll end up with repeating protocols. This will replace both protocols and output correctly: href="https://{{ user.userWebsite|replace({ 'https://': '', 'http://', '' }) }}" If the protocol is not entered, there will be no replacement, just your field content. This method ensures that you'll always get the secure protocol in your links.  
  
  ---
  
  