const defaultSiteUrl = "https://www.bluecapstrategies.com";

export const siteUrl = (import.meta.env.PUBLIC_SITE_URL ?? defaultSiteUrl).replace(/\/$/, "");

export function canonical(pathname: string) {
  const cleanPath = pathname.startsWith("/") ? pathname : `/${pathname}`;
  const withSlash = cleanPath.endsWith("/") ? cleanPath : `${cleanPath}/`;
  return `${siteUrl}${withSlash}`;
}

export function assetUrl(path: string) {
  return `${siteUrl}${path.startsWith("/") ? path : `/${path}`}`;
}
