export function useVariantPath() {
  const localePath = useLocalePath()
  const route = useRoute()

  function variantPath(page: string, anchor?: string) {
    let base = [localePath('/'), route.params.variant ?? '', page].filter(Boolean).join('/')
    base = base.replace(/\/{2,}/g, '/')
    base = base.replace(/\/+$/, '')
    base = base ? base : '/'
    return anchor ? `${base}#${anchor}` : base
  }

  return { variantPath }
}
