Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions apps/marketing/src/app/[locale]/blog/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import type { Metadata } from "next";
import Image from "next/image";
import Link from "next/link";
import { notFound } from "next/navigation";
import { setRequestLocale } from "next-intl/server";
import { MarketingFooter } from "@/components/marketing/footer";
import { MarketingHeader } from "@/components/marketing/header";
import { BlogPostingJsonLd } from "@/components/seo/json-ld";
import { ogMetadata, siteBase } from "@/lib/og";
import { blogSource } from "@/lib/source";

type Props = {
params: Promise<{ slug: string }>;
params: Promise<{ locale: string; slug: string }>;
};

type PostData = {
Expand All @@ -24,7 +25,10 @@ type PostData = {
};

export async function generateStaticParams() {
return blogSource.generateParams();
// Route is a single [slug] segment; fumadocs yields slug as a string[].
return blogSource
.generateParams()
.map(({ slug }) => ({ slug: slug.join("/") }));
}

export async function generateMetadata({ params }: Props): Promise<Metadata> {
Expand Down Expand Up @@ -58,7 +62,8 @@ function formatDate(input?: string): string {
}

export default async function BlogPost({ params }: Props) {
const { slug } = await params;
const { locale, slug } = await params;
setRequestLocale(locale);
const page = blogSource.getPage([slug]);
if (!page) notFound();
const MDX = page.data.body;
Expand Down
11 changes: 8 additions & 3 deletions apps/marketing/src/app/[locale]/changelog/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import type { Metadata } from "next";
import { notFound } from "next/navigation";
import { setRequestLocale } from "next-intl/server";
import { TechArticleJsonLd } from "@/components/seo/json-ld";
import { ogMetadata, siteBase } from "@/lib/og";
import { changelogSource } from "@/lib/source";

type Props = {
params: Promise<{ slug: string }>;
params: Promise<{ locale: string; slug: string }>;
};

export async function generateStaticParams() {
return changelogSource.generateParams();
// Route is a single [slug] segment; fumadocs yields slug as a string[].
return changelogSource
.generateParams()
.map(({ slug }) => ({ slug: slug.join("/") }));
}

export async function generateMetadata({ params }: Props): Promise<Metadata> {
Expand All @@ -31,7 +35,8 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
}

export default async function ChangelogEntryPage({ params }: Props) {
const { slug } = await params;
const { locale, slug } = await params;
setRequestLocale(locale);
const page = changelogSource.getPage([slug]);
if (!page) {
notFound();
Expand Down
6 changes: 4 additions & 2 deletions apps/marketing/src/app/[locale]/docs/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import {
} from "fumadocs-ui/page";
import type { Metadata } from "next";
import { notFound } from "next/navigation";
import { setRequestLocale } from "next-intl/server";
import { TechArticleJsonLd } from "@/components/seo/json-ld";
import { ogMetadata, siteBase } from "@/lib/og";
import { source } from "@/lib/source";

type Props = {
params: Promise<{ slug?: string[] }>;
params: Promise<{ locale: string; slug?: string[] }>;
};

export async function generateStaticParams() {
Expand Down Expand Up @@ -41,7 +42,8 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
}

export default async function DocsPageRoute({ params }: Props) {
const { slug } = await params;
const { locale, slug } = await params;
setRequestLocale(locale);
const page = source.getPage(slug);
if (!page) notFound();
const MDX = page.data.body;
Expand Down
13 changes: 12 additions & 1 deletion apps/marketing/src/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { GoogleAnalytics } from "@vibestack/analytics/ga";
import { LOCALES } from "@vibestack/i18n";
import type { Metadata } from "next";
import { Fraunces, Geist, JetBrains_Mono } from "next/font/google";
import { NextIntlClientProvider } from "next-intl";
import { getMessages } from "next-intl/server";
import { getMessages, setRequestLocale } from "next-intl/server";
import { ThemeProvider } from "next-themes";
import type { ReactNode } from "react";
import { Toaster } from "sonner";
Expand Down Expand Up @@ -62,8 +63,18 @@ type Props = {
params: Promise<{ locale: string }>;
};

// Prerender both locales so docs/blog/changelog static params can fan out
// under each. Without this the [locale] segment is request-time only.
export function generateStaticParams() {
return LOCALES.map((locale) => ({ locale }));
}

export default async function LocaleLayout({ children, params }: Props) {
const { locale } = await params;
// Opt into static rendering for next-intl: pins the locale into the request
// store so getMessages()/translations don't fall back to headers() (which
// would make every page dynamic and throw DYNAMIC_SERVER_USAGE on prerender).
setRequestLocale(locale);
const messages = await getMessages();
return (
<html
Expand Down
4 changes: 2 additions & 2 deletions apps/marketing/src/components/marketing/sections/hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export function Hero({ stars }: { stars?: number | null }) {
<div className="mt-7 flex flex-col gap-3 sm:flex-row sm:items-stretch">
<a
href={WEB_URLS.signUp}
className="hero-cta group inline-flex items-center justify-center gap-2 rounded-full bg-[color:var(--marketing-accent)] px-7 py-3.5 font-medium text-[color:var(--marketing-bg)] text-base transition-transform hover:scale-[1.02]"
className="hero-cta group inline-flex items-center justify-center gap-2 rounded-full border border-transparent bg-[color:var(--marketing-accent)] px-7 py-3.5 font-medium text-[color:var(--marketing-bg)] text-base transition-transform hover:scale-[1.02]"
>
Start building
<span
Expand All @@ -112,7 +112,7 @@ export function Hero({ stars }: { stars?: number | null }) {
href={GITHUB_URL}
target="_blank"
rel="noreferrer"
className="hero-cta inline-flex items-center justify-center gap-2.5 rounded-full border border-[color:var(--marketing-fg)]/25 px-6 py-3.5 text-[color:var(--marketing-fg)] text-base backdrop-blur-sm transition-colors hover:bg-[color:var(--marketing-fg)]/10"
className="hero-cta inline-flex items-center justify-center gap-2.5 rounded-full border border-[color:var(--marketing-fg)]/25 px-6 py-3.5 text-[color:var(--marketing-fg)] text-base transition-colors hover:bg-[color:var(--marketing-fg)]/10"
>
<GithubMark className="h-[1.1em] w-[1.1em]" />
Star on GitHub
Expand Down
Loading