{{- if .IsTranslated -}}
{{ range .AllTranslations }}
{{- if eq .Language.Lang "en" -}}
<link rel="alternate" hreflang="x-default" href="{{ .Permalink }}" />
{{- end -}}
<link rel="alternate" hreflang="{{ .Language.Lang }}" href="{{ .Permalink }}" />
{{- end -}}
{{ end }}
I solved the problem with this code, thank you for what you wrote anyway.