External Marketing Website in the Next.js Supabase Turbo Starter Kit
Learn how to configure Makerkit to work with an external marketing website in the Next.js Supabase Turbo Starter Kit.
Many teams prefer to create an external marketing website for their SaaS application. This allows them to have more control over the design and content of the website. For example, using services such as Framer, Webflow, or Wordpress.
In this case, we have to redirect all marketing pages to the external marketing website. You can do so tweaking the middleware in the apps/web/middleware.ts
file.
Take the list of all your marketing pages, and then add a middleware to redirect all those pages to the external marketing website.
import { NextRequest, NextResponse } from 'next/server';export function middleware(req: NextRequest) { if (isMarketingPage(req)) { return NextResponse.redirect('https://your-external-website.com' + req.nextUrl.pathname); } // leave the rest of the middleware unchanged}function isMarketingPage(req: NextRequest) { const marketingPages = [ '/pricing', '/faq', '/contact', '/about', '/home', '/privacy-policy', '/terms-and-conditions', '/cookie-policy', ]; return marketingPages.includes(req.nextUrl.pathname);}
Should you add a new marketing page, you need to update the isMarketingPage
function with the new page path.