List Output formats with hreflang

How can I adapt the List Output formats snippet to integrate hreflang when a translation is available?
Shouldn’t it be by default in the provided snippet as a “good practice”?

List Output formats snippet :

{{ range .AlternativeOutputFormats }}
  <link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}">
{{ end }}

This is what I use. Does this work for you?

{{ if .IsTranslated }}
  {{ range .AllTranslations }}
    <link href="{{ .Permalink }}" hreflang="{{ .Language.Lang }}" rel="alternate" />
  {{ end }}
{{ end }}

yes, thanks @Grob!

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.