Skip to content

The open alternative to Salesforce, designed for AI.

feat(website-new): add robots.txt, sitemap.xml and legacy redirects (#19911)

Charles Bochet34e3b1b90b32
diff --git a/packages/twenty-website-new/next.config.ts b/packages/twenty-website-new/next.config.ts
index 2e3eeb7e4d2..a12be196248 100644
--- a/packages/twenty-website-new/next.config.ts
+++ b/packages/twenty-website-new/next.config.ts
@@ -20,6 +20,116 @@ const nextConfig: LinariaConfig = {
configFile: path.resolve(__dirname, 'wyw-in-js.config.cjs'),
},
reactCompiler: true,
+ async redirects() {
+ return [
+ // Documentation moved to docs.twenty.com (carried over from the
+ // legacy twenty-website Next.js app).
+ {
+ source: '/user-guide',
+ destination: 'https://docs.twenty.com/user-guide/introduction',
+ permanent: true,
+ },
+ {
+ source: '/user-guide/section/:folder/:slug*',
+ destination: 'https://docs.twenty.com/user-guide/:folder/:slug*',
+ permanent: true,
+ },
+ {
+ source: '/user-guide/:folder/:slug*',
+ destination: 'https://docs.twenty.com/user-guide/:folder/:slug*',
+ permanent: true,
+ },
+ {
+ source: '/developers',
+ destination: 'https://docs.twenty.com/developers/introduction',
+ permanent: true,
+ },
+ {
+ source: '/developers/section/:folder/:slug*',
+ destination: 'https://docs.twenty.com/developers/:folder/:slug*',
+ permanent: true,
+ },
+ {
+ source: '/developers/:folder/:slug*',
+ destination: 'https://docs.twenty.com/developers/:folder/:slug*',
+ permanent: true,
+ },
+ {
+ source: '/developers/:slug',
+ destination: 'https://docs.twenty.com/developers/:slug',
+ permanent: true,
+ },
+ {
+ source: '/twenty-ui',
+ destination: 'https://docs.twenty.com/twenty-ui/introduction',
+ permanent: true,
+ },
+ {
+ source: '/twenty-ui/section/:folder/:slug*',
+ destination: 'https://docs.twenty.com/twenty-ui/:folder/:slug*',
+ permanent: true,
+ },
+ {
+ source: '/twenty-ui/:folder/:slug*',
+ destination: 'https://docs.twenty.com/twenty-ui/:folder/:slug*',
+ permanent: true,
+ },
+ {
+ source: '/twenty-ui/:slug',
+ destination: 'https://docs.twenty.com/twenty-ui/:slug',
+ permanent: true,
+ },
+
+ // Renamed/restructured pages on the new website. Mappings derived
+ // from the old twenty.com sitemap so existing inbound links and
+ // search results keep working.
+ {
+ source: '/story',
+ destination: '/why-twenty',
+ permanent: true,
+ },
+ {
+ source: '/legal/privacy',
+ destination: '/privacy-policy',
+ permanent: true,
+ },
+ {
+ source: '/legal/terms',
+ destination: '/terms',
+ permanent: true,
+ },
+ {
+ source: '/legal/dpa',
+ destination: '/terms',
+ permanent: true,
+ },
+ {
+ source: '/case-studies/9-dots-story',
+ destination: '/customers/9dots',
+ permanent: true,
+ },
+ {
+ source: '/case-studies/act-immi-story',
+ destination: '/customers/act-education',
+ permanent: true,
+ },
+ {
+ source: '/case-studies/:slug*',
+ destination: '/customers',
+ permanent: true,
+ },
+ {
+ source: '/implementation-services',
+ destination: '/partners',
+ permanent: true,
+ },
+ {
+ source: '/onboarding-packages',
+ destination: '/partners',
+ permanent: true,
+ },
+ ];
+ },
};
module.exports = withLinaria(nextConfig);
diff --git a/packages/twenty-website-new/src/app/robots.ts b/packages/twenty-website-new/src/app/robots.ts
new file mode 100644
index 00000000000..88a32aeee65
--- /dev/null
+++ b/packages/twenty-website-new/src/app/robots.ts
@@ -0,0 +1,16 @@
+import type { MetadataRoute } from 'next';
+
+const SITE_URL =
+ process.env.NEXT_PUBLIC_WEBSITE_URL?.replace(/\/$/, '') ?? 'https://twenty.com';
+
+export default function robots(): MetadataRoute.Robots {
+ return {
+ rules: [
+ {
+ userAgent: '*',
+ allow: '/',
+ },
+ ],
+ sitemap: `${SITE_URL}/sitemap.xml`,
+ };
+}
diff --git a/packages/twenty-website-new/src/app/sitemap.ts b/packages/twenty-website-new/src/app/sitemap.ts
new file mode 100644
index 00000000000..208834ac8f4
--- /dev/null
+++ b/packages/twenty-website-new/src/app/sitemap.ts
@@ -0,0 +1,40 @@
+import type { MetadataRoute } from 'next';
+
+import { CASE_STUDY_CATALOG_ENTRIES } from '@/app/customers/_constants/case-study-catalog';
+
+const SITE_URL =
+ process.env.NEXT_PUBLIC_WEBSITE_URL?.replace(/\/$/, '') ?? 'https://twenty.com';
+
+const STATIC_ROUTES: ReadonlyArray<{
+ path: string;
+ changeFrequency: MetadataRoute.Sitemap[number]['changeFrequency'];
+ priority: number;
+}> = [
+ { path: '/', changeFrequency: 'weekly', priority: 1.0 },
+ { path: '/why-twenty', changeFrequency: 'monthly', priority: 0.8 },
+ { path: '/product', changeFrequency: 'monthly', priority: 0.8 },
+ { path: '/pricing', changeFrequency: 'monthly', priority: 0.9 },
+ { path: '/partners', changeFrequency: 'monthly', priority: 0.7 },
+ { path: '/releases', changeFrequency: 'weekly', priority: 0.7 },
+ { path: '/customers', changeFrequency: 'monthly', priority: 0.7 },
+ { path: '/privacy-policy', changeFrequency: 'yearly', priority: 0.3 },
+ { path: '/terms', changeFrequency: 'yearly', priority: 0.3 },
+];
+
+export default function sitemap(): MetadataRoute.Sitemap {
+ const staticEntries = STATIC_ROUTES.map(
+ ({ path, changeFrequency, priority }) => ({
+ url: `${SITE_URL}${path}`,
+ changeFrequency,
+ priority,
+ }),
+ );
+
+ const caseStudyEntries = CASE_STUDY_CATALOG_ENTRIES.map((entry) => ({
+ url: `${SITE_URL}${entry.href}`,
+ changeFrequency: 'yearly' as const,
+ priority: 0.5,
+ }));
+
+ return [...staticEntries, ...caseStudyEntries];
+}