Answers.Body: <p>Have you tried using <code>{{ craft.entries.id(entry.id).locale(locale.id).first().url }}</code> inside the for loop you have made?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-30T08:07:16.863Z
Answers.Text: Great, glad it sorted it for you, see you at the next craft meet up :P
Answers.UserDisplayName: Matt Shearing
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-29T15:49:49.640Z
Answers.LastActivityDate: 2017-03-29T15:49:49.640Z
Answers.UserDisplayName: Matt Shearing
Body: <p>Just adding hreflang tags to the head on all pages of my multi-locale site...</p>
  
  <pre><code>{% for locale in craft.i18n.getSiteLocales() %}
      &lt;link rel="alternate" href="{{ entry.url }}" hreflang="{{ locale }}"&gt;
  {% endfor %}
  </code></pre>
  
  <p>Nearly there, but obviously this outputs my list of locales with the entry url for the <em>current locale</em> only. What I need is to output the entry url for <em>each locale</em>. Anyone done this before?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-04-28T15:27:34.520Z
Comments.Text: The accepted answer works - however, beware that the `hreflang` attribute should not necessarily be the same format as Craft's `locale` values. Depending on your locales, you may need to translate them into their ISO equivalents for language and country. For example `en_ca` would become `en-CA`.
Comments.UserDisplayName: James Smith
Tags: <localization>
Title: Output Locale URLs in hreflang
ThreadText: # Output Locale URLs in hreflang
  
  (Asked by: username_0 on 2017-03-29)
  
  Just adding hreflang tags to the head on all pages of my multi-locale site...
  
  ```
  {% for locale in craft.i18n.getSiteLocales() %}
      <link rel="alternate" href="{{ entry.url }}" hreflang="{{ locale }}">
  {% endfor %}
  
  ```
  
  Nearly there, but obviously this outputs my list of locales with the entry url for the *current locale* only. What I need is to output the entry url for *each locale*. Anyone done this before?
  
  **Tags:** localization
  
  > **Comments:**
  > **username_1**: The accepted answer works - however, beware that the `hreflang` attribute should not necessarily be the same format as Craft's `locale` values. Depending on your locales, you may need to translate them into their ISO equivalents for language and country. For example `en_ca` would become `en-CA`.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2017-03-29. Score: 2 | Accepted answer
  
  Have you tried using `{{ craft.entries.id(entry.id).locale(locale.id).first().url }}` inside the for loop you have made?
  
  > **Comments:**
  > **username_2**: Great, glad it sorted it for you, see you at the next craft meet up :P  
  
  ---
  
  