How AI is powering better personalization in e-commerce [with Vercel]. Sign up now →

Configure custom layout for homepage in Next.js Landing Pages Template

7 repliesLast updated: Nov 29, 2025

Happy Friday 👋 - I am using the Next.js Landing Pages Template. At the moment all pages default to the 'LandingPage' layout, however I'd like to create a custom layout just for my homepage (to hide the footer etc). Is there a way for me to configure this? To direct 'frontpage' and '/' to the CustomLayout.js rather than the LandingPage.js?
AI Update

Great question! Yes, you can definitely configure a custom layout for your homepage in the Next.js Landing Pages Template. Based on a previous discussion about this exact issue, here's how to do it:

Solution: Edit your next.config.js

The template uses the next.config.js file to map routes to page templates. By default, all routes (including /) use the LandingPage template, except /custom-page which uses the CustomPage template.

To direct your homepage to a custom layout:

exportPathMap: function () {
  return client.fetch(query).then((res) => {
    const { routes = [] } = res;
    const nextRoutes = {
      // Routes imported from sanity
      ...routes.filter(({ slug }) => slug.current).reduce(reduceRoutes, {}),
      "/": { page: "/CustomPage" }, // Add this line
    };
    return nextRoutes;
  });
}

Alternative Approach

If you only need to hide the footer on the homepage, you could also check the current slug inside the LandingPage component and conditionally show/hide the footer based on whether you're on the homepage:

{router.query.slug !== '/' && <Footer />}

This approach is simpler if you just need minor variations rather than a completely different layout.

Note: This template uses an older Next.js Pages Router pattern with exportPathMap. If you're working with a newer Next.js setup, you'd typically handle this through the file-based routing system or dynamic routes instead.

Show original thread
7 replies

Was this answer helpful?

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Related contributions