Skip to content

Commit 6c8a48d

Browse files
committed
fix: fix changelogs
1 parent f6e8d89 commit 6c8a48d

File tree

6 files changed

+8
-14
lines changed

6 files changed

+8
-14
lines changed

app/changelog/[...slug]/page.tsx

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { Metadata, ResolvingMetadata } from "next";
1+
import { Metadata } from "next";
22
import { notFound } from "next/navigation";
33
import * as React from "react";
44

55
import { getChangelogEntryBySlug, getChangelogs } from "@/lib/changelog-api";
66

7-
import Changelogs from "../changelogs";
7+
import { Changelogs } from "../changelogs";
88

99
type Props = {
1010
params: { slug: string[] };
@@ -59,10 +59,6 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
5959
};
6060
}
6161

62-
const dateFormatter = new Intl.DateTimeFormat("en-US", {
63-
dateStyle: "long",
64-
});
65-
6662
export default async function Page({ params }: Props) {
6763
const changelog = await getChangelogFromParams(params);
6864
if (!changelog) {

app/changelog/changelogs.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const dateFormatter = new Intl.DateTimeFormat("en-US", {
88
dateStyle: "long",
99
});
1010

11-
export default function Changelogs(props: {
11+
export function Changelogs(props: {
1212
changelogs: ChangelogEntry[];
1313
single?: boolean;
1414
}) {

app/changelog/page.tsx

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import { Metadata } from "next";
22

3-
import { Container } from "@/components/Container";
4-
import { Link } from "@/components/Link";
53
import { getChangelogs } from "@/lib/changelog-api";
64
import { getMetadata } from "@/lib/metadata";
75

8-
import Changelogs from "./changelogs";
6+
import { Changelogs } from "./changelogs";
97

108
export const metadata: Metadata = getMetadata({
119
title: "Changelog",

app/changelog/sitemap.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default async function sitemap({
1111
}): Promise<MetadataRoute.Sitemap> {
1212
const changelogs = await getChangelogs();
1313
return changelogs.map((changelog) => ({
14-
url: `${BASE_URL}/changelogs/${changelog.slug}`,
14+
url: `${BASE_URL}/changelog/${changelog.slug}`,
1515
lastModified: changelog.date,
1616
}));
1717
}

lib/changelog-api.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ async function getChangelogFromPath(
5858
return null;
5959
}
6060
const slug = filepath
61-
.replace(/^.\/changelogs\//, "")
61+
.replace(/^.\/changelog-entries\//, "")
6262
.replace(/\/index.mdx$/, "");
6363

6464
const DD_MM_YYYY = frontmatter.date.toISOString().split("T")[0];
@@ -81,7 +81,7 @@ function validateAllChangelogs(
8181
}
8282

8383
export async function getChangelogs(): Promise<ChangelogEntry[]> {
84-
const files = await fg("./changelogs/**/*.mdx");
84+
const files = await fg("./changelog-entries/**/*.mdx");
8585
const changelogs = await Promise.all(files.map(getChangelogFromPath));
8686
validateAllChangelogs(changelogs);
8787
return changelogs.sort(
@@ -93,6 +93,6 @@ export async function getChangelogEntryBySlug(
9393
slug: string,
9494
): Promise<ChangelogEntry | null> {
9595
const slugWithoutDate = slug.split("-").slice(3).join("-");
96-
const filepath = `./changelogs/${slugWithoutDate}/index.mdx`;
96+
const filepath = `./changelog-entries/${slugWithoutDate}/index.mdx`;
9797
return getChangelogFromPath(filepath);
9898
}

0 commit comments

Comments
 (0)