diff --git a/README.md b/README.md index 107378b..5ec2965 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Copy `.env.example` to `.env.production` (or `.env.local` for development) and f | `RESEND_API_KEY` | yes | Resend key with sending access to `aigrowthtechnologies.com`. Without it the contact form shows an error. | | `CONTACT_FROM` | yes | Sender, on the domain verified in Resend: `AI Growth Website ` | | `CONTACT_TO` | no | Inbox that receives enquiries; separate several with commas. Defaults to `rey@aigrowth360.io`. | +| `SITE_URL` | no | Public address used for canonical links, hreflang, `sitemap.xml` and `robots.txt`. Defaults to `https://aigrowthtechnologies.com`. | | `CAPTCHA_SECRET` | no | Signs the contact form's "I'm not a robot" challenges (a self-hosted proof of work, no third-party account). Without it a random secret is used per process, which only matters across restarts. | ## Deploying to a VPS diff --git a/src/app/sitemap.ts b/src/app/sitemap.ts index 1a5bdfb..da27edd 100644 --- a/src/app/sitemap.ts +++ b/src/app/sitemap.ts @@ -13,10 +13,13 @@ export default function sitemap(): MetadataRoute.Sitemap { ...industryNav.map((s) => `/industries/${s.slug}`), ]; const url = (p: string) => SITE_URL + (p === "/" ? "" : p); + const lastModified = new Date(); return locales.flatMap((locale) => paths.map((p) => ({ url: url(localize(p, locale)), + lastModified, + changeFrequency: "monthly" as const, priority: p === "/" ? 1 : p.split("/").length === 2 ? 0.8 : 0.6, alternates: { languages: Object.fromEntries(locales.map((l) => [l, url(localize(p, l))])) }, })), diff --git a/src/lib/routes.ts b/src/lib/routes.ts index 4bdb890..6e9f13e 100644 --- a/src/lib/routes.ts +++ b/src/lib/routes.ts @@ -1,6 +1,8 @@ // Route map and navigation. Kept free of page content so client components can import it. -export const SITE_URL = "https://www.aigrowthtechnologies.com"; +// The live address used in canonical URLs, hreflang links, the sitemap and robots.txt. +// Override with SITE_URL if the site moves to another host (for example the www subdomain). +export const SITE_URL = (process.env.SITE_URL || "https://aigrowthtechnologies.com").replace(/\/$/, ""); export const CONTACT_EMAIL = "info@aigrowthtechnologies.com"; export const serviceNav = [