export function useSeoLinking() {
  const config = useContentConfig()
  const locales = config.locale?.list.map(l => l.code) ?? []

  const {locale} = useContentInjected()

  const route = useRoute()
  const base = 'https://panoramablick-saalbach.at'

  const links = computed(() => {
    const links = []

    for (const l of locales) {
      const path = '/' + l + route.path.slice(3)
      links.push({rel: 'alternate', hreflang: l, href: base + path})

      if (l === locale.value) {
        links.push({rel: 'canonical', href: base + path})
      }
    }

    return links
  })

  useHead(() => ({link: links.value}))
}