Skip to content

Commit

Permalink
page titles
Browse files Browse the repository at this point in the history
  • Loading branch information
ntotten committed Oct 8, 2023
1 parent 32a3ea2 commit 4b5e61f
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
21 changes: 21 additions & 0 deletions src/app/docs/[...slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,33 @@
import { DocsLayout } from "@/components/DocsLayout";
import { getAllContent, getContentBySlug } from "@/lib/content";
import { compileMdx } from "@/lib/markdown/mdx";
import { Metadata } from "next";
import { notFound } from "next/navigation";

interface ArticleFrontMatter {
title: string;
}

export async function generateMetadata({
params,
}: {
params: { slug: string[] };
}): Promise<Metadata> {
const result = await getContentBySlug<ArticleFrontMatter>({
dir: "docs",
baseUrlPath: "/docs",
slug: params.slug,
});
if (!result) {
return {};
}

const { data } = result;
return {
title: data.title,
};
}

export default async function Page({ params }: { params: { slug: string[] } }) {
const result = await getContentBySlug<ArticleFrontMatter>({
dir: "docs",
Expand Down
5 changes: 5 additions & 0 deletions src/app/docs/articles/node-modules/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { DocsLayout } from "@/components/DocsLayout";
import { Bundle } from "@/lib/interfaces";
import { readFile } from "fs/promises";
import { Metadata } from "next";
import Link from "next/link";
import { join } from "path";

export const metadata: Metadata = {
title: "Node Modules",
};

export default async function Page() {
const data = (
(await readFile(join(process.cwd(), "./bundles.json"), "utf-8").then(
Expand Down
5 changes: 5 additions & 0 deletions src/app/docs/policies/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { Metadata } from "next";
import Link from "next/link";
import { DocsHeader } from "../../../components/DocsHeader";
import { getAllPolicies } from "../../../lib/policies";

export const metadata: Metadata = {
title: "Policies",
};

export default async function Page() {
const policies = await getAllPolicies();

Expand Down
6 changes: 2 additions & 4 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ import { beVietnamProFont } from "../lib/fonts";

export const metadata: Metadata = {
title: {
template: "%s - Docs",
default: "CacheAdvance - Never miss the cache again.",
template: "%s - Zuplo Docs",
default: "Zuplo",
},
description:
"Cache every single thing your app could ever do ahead of time, so your code never even has to run at all.",
};

export default function RootLayout({
Expand Down

0 comments on commit 4b5e61f

Please sign in to comment.