Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

⚡️ Statically prerender landing pages with Cache Components (#2508)

Luke Vella3d21cc4fcbc8
diff --git a/apps/landing/src/app/[locale]/(main)/(seo)/best-doodle-alternative/page.tsx b/apps/landing/src/app/[locale]/(main)/(seo)/best-doodle-alternative/page.tsx
index 3f5710041..80f3b9d02 100644
--- a/apps/landing/src/app/[locale]/(main)/(seo)/best-doodle-alternative/page.tsx
+++ b/apps/landing/src/app/[locale]/(main)/(seo)/best-doodle-alternative/page.tsx
@@ -1,4 +1,7 @@
+"use cache";
+
import type { Metadata } from "next";
+import { cacheLife } from "next/cache";
import { Trans } from "react-i18next/TransWithoutContext";
import Bonus from "@/components/home/bonus";
import { MarketingHero } from "@/components/home/hero";
@@ -8,6 +11,7 @@ import { getTranslation } from "@/i18n/server";
export default async function Page(props: {
params: Promise<{ locale: string }>;
}) {
+ cacheLife("max");
const { locale } = await props.params;
const { t } = await getTranslation(locale, ["home"]);
return (
@@ -31,6 +35,7 @@ export default async function Page(props: {
export async function generateMetadata(props: {
params: Promise<{ locale: string }>;
}): Promise<Metadata> {
+ cacheLife("max");
const { locale } = await props.params;
const { t } = await getTranslation(locale, "home");
return {
diff --git a/apps/landing/src/app/[locale]/(main)/(seo)/free-scheduling-poll/page.tsx b/apps/landing/src/app/[locale]/(main)/(seo)/free-scheduling-poll/page.tsx
index e25ef0470..0b99503a0 100644
--- a/apps/landing/src/app/[locale]/(main)/(seo)/free-scheduling-poll/page.tsx
+++ b/apps/landing/src/app/[locale]/(main)/(seo)/free-scheduling-poll/page.tsx
@@ -1,4 +1,7 @@
+"use cache";
+
import type { Metadata } from "next";
+import { cacheLife } from "next/cache";
import { Trans } from "react-i18next/TransWithoutContext";
import Bonus from "@/components/home/bonus";
import { MarketingHero } from "@/components/home/hero";
@@ -8,6 +11,7 @@ import { getTranslation } from "@/i18n/server";
export default async function Page(props: {
params: Promise<{ locale: string }>;
}) {
+ cacheLife("max");
const { locale } = await props.params;
const { t } = await getTranslation(locale, ["home"]);
return (
@@ -31,6 +35,7 @@ export default async function Page(props: {
export async function generateMetadata(props: {
params: Promise<{ locale: string }>;
}): Promise<Metadata> {
+ cacheLife("max");
const { locale } = await props.params;
const { t } = await getTranslation(locale, "home");
return {
diff --git a/apps/landing/src/app/[locale]/(main)/(seo)/when2meet-alternative/page.tsx b/apps/landing/src/app/[locale]/(main)/(seo)/when2meet-alternative/page.tsx
index 2de320ede..20bf470ca 100644
--- a/apps/landing/src/app/[locale]/(main)/(seo)/when2meet-alternative/page.tsx
+++ b/apps/landing/src/app/[locale]/(main)/(seo)/when2meet-alternative/page.tsx
@@ -1,4 +1,7 @@
+"use cache";
+
import type { Metadata } from "next";
+import { cacheLife } from "next/cache";
import { Trans } from "react-i18next/TransWithoutContext";
import Bonus from "@/components/home/bonus";
import { MarketingHero } from "@/components/home/hero";
@@ -8,6 +11,7 @@ import { getTranslation } from "@/i18n/server";
export default async function Page(props: {
params: Promise<{ locale: string }>;
}) {
+ cacheLife("max");
const { locale } = await props.params;
const { t } = await getTranslation(locale, ["home"]);
return (
@@ -31,6 +35,7 @@ export default async function Page(props: {
export async function generateMetadata(props: {
params: Promise<{ locale: string }>;
}): Promise<Metadata> {
+ cacheLife("max");
const { locale } = await props.params;
const { t } = await getTranslation(locale, "home");
return {
diff --git a/apps/landing/src/app/[locale]/(main)/blog/[slug]/page.tsx b/apps/landing/src/app/[locale]/(main)/blog/[slug]/page.tsx
index eeda9710a..f7f5c1ad0 100644
--- a/apps/landing/src/app/[locale]/(main)/blog/[slug]/page.tsx
+++ b/apps/landing/src/app/[locale]/(main)/blog/[slug]/page.tsx
@@ -1,7 +1,10 @@
+"use cache";
+
import { buttonVariants } from "@rallly/ui";
import { absoluteUrl } from "@rallly/utils/absolute-url";
import { ArrowLeftIcon } from "lucide-react";
import type { Metadata } from "next";
+import { cacheLife } from "next/cache";
import Image from "next/image";
import Link from "next/link";
import { notFound } from "next/navigation";
@@ -12,6 +15,7 @@ import { getAllPosts, getPostBySlug } from "@/lib/api";
export default async function Page(props: {
params: Promise<{ locale: string; slug: string }>;
}) {
+ cacheLife("max");
const params = await props.params;
const post = getPostBySlug(params.slug, [
"title",
@@ -75,6 +79,7 @@ export async function generateStaticParams() {
export async function generateMetadata(props: {
params: Promise<{ locale: string; slug: string }>;
}): Promise<Metadata> {
+ cacheLife("max");
const params = await props.params;
const post = getPostBySlug(params.slug, [
"title",
diff --git a/apps/landing/src/app/[locale]/(main)/blog/page.tsx b/apps/landing/src/app/[locale]/(main)/blog/page.tsx
index 6fc274d73..9af51e906 100644
--- a/apps/landing/src/app/[locale]/(main)/blog/page.tsx
+++ b/apps/landing/src/app/[locale]/(main)/blog/page.tsx
@@ -1,4 +1,7 @@
+"use cache";
+
import type { Metadata } from "next";
+import { cacheLife } from "next/cache";
import { Trans } from "react-i18next/TransWithoutContext";
import { getTranslation } from "@/i18n/server";
import { getAllPosts } from "@/lib/api";
@@ -7,6 +10,7 @@ import { PostPreview } from "./post-preview";
export default async function Page(props: {
params: Promise<{ locale: string }>;
}) {
+ cacheLife("max");
const { locale } = await props.params;
const { t } = await getTranslation(locale, "blog");
const allPosts = getAllPosts([
@@ -48,6 +52,7 @@ export default async function Page(props: {
export async function generateMetadata(props: {
params: Promise<{ locale: string }>;
}): Promise<Metadata> {
+ cacheLife("max");
const { locale } = await props.params;
const { t } = await getTranslation(locale, "blog");
return {
diff --git a/apps/landing/src/app/[locale]/(main)/cookie-policy/page.tsx b/apps/landing/src/app/[locale]/(main)/cookie-policy/page.tsx
index 943642e20..9e40ececd 100644
--- a/apps/landing/src/app/[locale]/(main)/cookie-policy/page.tsx
+++ b/apps/landing/src/app/[locale]/(main)/cookie-policy/page.tsx
@@ -1,4 +1,9 @@
-export default function CookiePolicy() {
+"use cache";
+
+import { cacheLife } from "next/cache";
+
+export default async function CookiePolicy() {
+ cacheLife("max");
return (
<div className="prose mx-auto max-w-3xl">
<h1>Cookie Policy</h1>
@@ -57,7 +62,8 @@ export default function CookiePolicy() {
);
}
-export function generateMetadata() {
+export async function generateMetadata() {
+ cacheLife("max");
return {
title: "Rallly: Cookie Policy",
description: "The cookie policy for Rallly.",
diff --git a/apps/landing/src/app/[locale]/(main)/layout.tsx b/apps/landing/src/app/[locale]/(main)/layout.tsx
index 2e1dada8f..b5169e20a 100644
--- a/apps/landing/src/app/[locale]/(main)/layout.tsx
+++ b/apps/landing/src/app/[locale]/(main)/layout.tsx
@@ -12,6 +12,7 @@ import {
import { Icon } from "@rallly/ui/icon";
import { MenuIcon } from "lucide-react";
import type { Viewport } from "next";
+import { cacheLife } from "next/cache";
import Image from "next/image";
import { Trans } from "react-i18next/TransWithoutContext";
@@ -37,6 +38,8 @@ export default async function Root(props: {
children: React.ReactNode;
params: Promise<{ locale: string }>;
}) {
+ "use cache";
+ cacheLife("max");
const { children, params } = props;
const { locale } = await params;
diff --git a/apps/landing/src/app/[locale]/(main)/page.tsx b/apps/landing/src/app/[locale]/(main)/page.tsx
index ccb897bf5..fd763761d 100644
--- a/apps/landing/src/app/[locale]/(main)/page.tsx
+++ b/apps/landing/src/app/[locale]/(main)/page.tsx
@@ -1,4 +1,7 @@
+"use cache";
+
import type { Metadata } from "next";
+import { cacheLife } from "next/cache";
import Bonus from "@/components/home/bonus";
import { MarketingHero } from "@/components/home/hero";
import { BigTestimonial, Marketing, MentionedBy } from "@/components/marketing";
@@ -7,6 +10,7 @@ import { getTranslation } from "@/i18n/server";
export default async function Page(props: {
params: Promise<{ locale: string }>;
}) {
+ cacheLife("max");
const { locale } = await props.params;
const { t } = await getTranslation(locale, ["home", "common"]);
return (
@@ -35,6 +39,7 @@ export default async function Page(props: {
export async function generateMetadata(props: {
params: Promise<{ locale: string }>;
}): Promise<Metadata> {
+ cacheLife("max");
const { locale } = await props.params;
const { t } = await getTranslation(locale, "home");
return {
diff --git a/apps/landing/src/app/[locale]/(main)/pricing/page.tsx b/apps/landing/src/app/[locale]/(main)/pricing/page.tsx
index de7b3292a..78d8242b4 100644
--- a/apps/landing/src/app/[locale]/(main)/pricing/page.tsx
+++ b/apps/landing/src/app/[locale]/(main)/pricing/page.tsx
@@ -1,4 +1,7 @@
+"use cache";
+
import { BirdIcon } from "lucide-react";
+import { cacheLife } from "next/cache";
import Link from "next/link";
import { Trans } from "react-i18next/TransWithoutContext";
@@ -125,6 +128,7 @@ const FAQ = async (props: { locale: string }) => {
export default async function Page(props: {
params: Promise<{ locale: string }>;
}) {
+ cacheLife("max");
const { locale } = await props.params;
const { t } = await getTranslation(locale, "pricing");
return (
@@ -182,6 +186,7 @@ export default async function Page(props: {
export async function generateMetadata(props: {
params: Promise<{ locale: string }>;
}) {
+ cacheLife("max");
const { locale } = await props.params;
const { t } = await getTranslation(locale, ["common", "pricing"]);
return {
diff --git a/apps/landing/src/app/[locale]/(main)/privacy-policy/page.tsx b/apps/landing/src/app/[locale]/(main)/privacy-policy/page.tsx
index 2143e521e..dd4b6ba6f 100644
--- a/apps/landing/src/app/[locale]/(main)/privacy-policy/page.tsx
+++ b/apps/landing/src/app/[locale]/(main)/privacy-policy/page.tsx
@@ -1,4 +1,9 @@
-export default function PrivacyPolicy() {
+"use cache";
+
+import { cacheLife } from "next/cache";
+
+export default async function PrivacyPolicy() {
+ cacheLife("max");
return (
<div className="prose mx-auto max-w-3xl">
<h1>Privacy Policy</h1>
@@ -120,7 +125,8 @@ export default function PrivacyPolicy() {
);
}
-export function generateMetadata() {
+export async function generateMetadata() {
+ cacheLife("max");
return {
title: "Rallly: Privacy Policy",
description: "The privacy policy for Rallly.",
diff --git a/apps/landing/src/app/[locale]/(main)/terms-of-use/page.tsx b/apps/landing/src/app/[locale]/(main)/terms-of-use/page.tsx
index b9a2107d6..b2bc8791d 100644
--- a/apps/landing/src/app/[locale]/(main)/terms-of-use/page.tsx
+++ b/apps/landing/src/app/[locale]/(main)/terms-of-use/page.tsx
@@ -1,6 +1,10 @@
+"use cache";
+
import type { Metadata } from "next";
+import { cacheLife } from "next/cache";
-export default function TermsOfUse() {
+export default async function TermsOfUse() {
+ cacheLife("max");
return (
<div className="prose mx-auto max-w-3xl">
<h1>Terms of Use</h1>
@@ -232,7 +236,8 @@ export default function TermsOfUse() {
);
}
-export function generateMetadata(): Metadata {
+export async function generateMetadata(): Promise<Metadata> {
+ cacheLife("max");
return {
title: "Rallly: Terms of Use",
description: "The terms of use for Rallly.",
diff --git a/apps/landing/src/app/[locale]/layout.tsx b/apps/landing/src/app/[locale]/layout.tsx
index b3fd4f343..46db94bd8 100644
--- a/apps/landing/src/app/[locale]/layout.tsx
+++ b/apps/landing/src/app/[locale]/layout.tsx
@@ -4,6 +4,7 @@ import languages from "@rallly/languages";
import { Analytics } from "@vercel/analytics/react";
import { domAnimation, LazyMotion } from "motion/react";
import type { Metadata, Viewport } from "next";
+import { cacheLife } from "next/cache";
import { Suspense } from "react";
import { PostHogPageView } from "@/components/posthog-page-view";
import { sans } from "@/fonts/sans";
@@ -23,6 +24,8 @@ export default async function Root(props: {
children: React.ReactNode;
params: Promise<{ locale: string }>;
}) {
+ "use cache";
+ cacheLife("max");
const { children, params } = props;
const { locale } = await params;
diff --git a/apps/landing/src/app/[locale]/licensing/thank-you/page.tsx b/apps/landing/src/app/[locale]/licensing/thank-you/page.tsx
index 7398598a7..7f3787515 100644
--- a/apps/landing/src/app/[locale]/licensing/thank-you/page.tsx
+++ b/apps/landing/src/app/[locale]/licensing/thank-you/page.tsx
@@ -1,3 +1,6 @@
+"use cache";
+
+import { cacheLife } from "next/cache";
import Image from "next/image";
import { Trans } from "react-i18next/TransWithoutContext";
import { LinkBase } from "@/i18n/client/link";
@@ -6,6 +9,7 @@ import { getTranslation } from "@/i18n/server";
export default async function LicensingThankYouPage(props: {
params: Promise<{ locale: string }>;
}) {
+ cacheLife("max");
const { locale } = await props.params;
const { t } = await getTranslation(locale);
return (