import { getHomepageContent } from '$lib/server/content';

const onboardingHosts = new Set(['onboarding.goodwalk.co.nz']);

export async function load({ url }) {
  const hostname = url.hostname.toLowerCase();
  const siteVariant =
    onboardingHosts.has(hostname) || url.searchParams.get('preview') === 'onboarding'
      ? 'onboarding'
      : 'marketing';

  if (siteVariant === 'onboarding') {
    return {
      siteVariant,
      isPreview: url.searchParams.get('preview') === 'onboarding'
    };
  }

  return {
    siteVariant,
    content: await getHomepageContent()
  };
}
