Skip to content

Commit 9bdea1f

Browse files
committed
More static fixes
1 parent d87ee8b commit 9bdea1f

File tree

30 files changed

+1482
-1579
lines changed

30 files changed

+1482
-1579
lines changed

app/(pages)/[slug]/twitter-image.tsx renamed to app/(pages)/[...slug]/_opengraph-image.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ export default async function og({ params }: { params: { slug: string } }) {
1111
// @ts-ignore
1212
return getImage({ page });
1313
}
14+
15+
export async function generateStaticParams() {
16+
return [];
17+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import { MDXRemote } from "components/mdx-remote/mdx-remote";
22
import { getPage } from "./get-page";
33
import { notFound } from "next/navigation";
4+
import { glob } from "glob";
45

56
// we are not using a catch-all because of this issue:
67
// https://github.com/vercel/next.js/issues/48162
78
export async function generateMetadata({
89
params,
910
}: {
10-
params: { slug: string };
11+
params: { slug: string[] };
1112
}) {
1213
try {
13-
const { data } = await getPage([params.slug], false);
14+
const { data } = await getPage(params.slug, false);
1415

1516
return {
1617
title: data.title,
@@ -22,9 +23,9 @@ export async function generateMetadata({
2223
}
2324
}
2425

25-
export default async function Page({ params }: { params: { slug: string } }) {
26+
export default async function Page({ params }: { params: { slug: string[] } }) {
2627
try {
27-
const { mdxSource } = await getPage([params.slug]);
28+
const { mdxSource } = await getPage(params.slug);
2829

2930
/* @ts-ignore */
3031
return <MDXRemote {...mdxSource} />;
@@ -35,17 +36,15 @@ export default async function Page({ params }: { params: { slug: string } }) {
3536
}
3637
}
3738

38-
// export async function getStaticPaths() {
39-
// const pages = glob.sync("data/pages-content/**/*.md");
39+
export async function generateStaticParams() {
40+
const pages = glob.sync("data/pages-content/**/*.md");
4041

41-
// const paths = pages.map((page) => ({
42-
// params: {
43-
// parts: page
44-
// .replace("data/pages-content/", "")
45-
// .replace(".md", "")
46-
// .split("/"),
47-
// },
48-
// }));
42+
return pages.map((page) => {
43+
const slug = page
44+
.replace("data/pages-content/", "")
45+
.replace(".md", "")
46+
.split("/");
4947

50-
// return { paths, fallback: false };
51-
// }
48+
return { slug };
49+
});
50+
}

app/(pages)/[slug]/[secondLevel]/opengraph-image.tsx

Lines changed: 0 additions & 17 deletions
This file was deleted.

app/(pages)/[slug]/[secondLevel]/page.tsx

Lines changed: 0 additions & 55 deletions
This file was deleted.

app/(pages)/[slug]/[secondLevel]/twitter-image.tsx

Lines changed: 0 additions & 17 deletions
This file was deleted.

app/(pages)/[slug]/opengraph-image.tsx

Lines changed: 0 additions & 13 deletions
This file was deleted.

app/(pages)/keynoters/[slug]/opengraph-image.tsx renamed to app/(pages)/keynoters/[slug]/_opengraph-image.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { fetchKeynoteBySpeakerSlug } from "@/lib/pretalx/submissions";
1+
import {
2+
fetchConfirmedSubmissions,
3+
fetchKeynoteBySpeakerSlug,
4+
} from "@/lib/pretalx/submissions";
25
import { OpenGraphImageKeynoter } from "components/opengraph-image/opengraph-image-keynoter";
36
import { ImageResponse } from "next/og";
47

@@ -20,3 +23,11 @@ export default async function og({ params }: { params: { slug: string } }) {
2023
)
2124
);
2225
}
26+
27+
export async function generateStaticParams() {
28+
const submissions = await fetchConfirmedSubmissions();
29+
30+
return submissions.map((submission) => ({
31+
slug: submission.slug,
32+
}));
33+
}

0 commit comments

Comments
 (0)