1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-10-18 20:54:27 -04:00

attempt to fix metadata merging

This commit is contained in:
2025-04-22 22:17:32 -04:00
parent fe055116d5
commit 6c3cd0afe9
25 changed files with 411 additions and 413 deletions

View File

@@ -9,7 +9,7 @@ import Comments from "../../../components/Comments";
import Loading from "../../../components/Loading";
import HitCounter from "./counter";
import { getSlugs, getFrontMatter } from "../../../lib/helpers/posts";
import { addMetadata } from "../../../lib/helpers/metadata";
import { createMetadata } from "../../../lib/helpers/metadata";
import * as config from "../../../lib/config";
import { POSTS_DIR } from "../../../lib/config/constants";
import { size as ogImageSize } from "./opengraph-image";
@@ -37,9 +37,10 @@ export const generateMetadata = async ({ params }: { params: Promise<{ slug: str
const { slug } = await params;
const frontmatter = await getFrontMatter(slug);
return addMetadata({
return createMetadata({
title: frontmatter!.title,
description: frontmatter!.description,
canonical: `/${POSTS_DIR}/${slug}`,
openGraph: {
type: "article",
authors: [config.authorName],
@@ -50,9 +51,6 @@ export const generateMetadata = async ({ params }: { params: Promise<{ slug: str
twitter: {
card: "summary_large_image",
},
alternates: {
canonical: `/${POSTS_DIR}/${slug}`,
},
});
};
@@ -63,7 +61,7 @@ const Page = async ({ params }: { params: Promise<{ slug: string }> }) => {
const { default: MDXContent } = await import(`../../../${POSTS_DIR}/${slug}/index.mdx`);
return (
<>
<article>
<JsonLd<BlogPosting>
item={{
"@context": "https://schema.org",
@@ -155,7 +153,7 @@ const Page = async ({ params }: { params: Promise<{ slug: string }> }) => {
</Suspense>
</div>
)}
</>
</article>
);
};

View File

@@ -1,7 +1,7 @@
import Link from "../../components/Link";
import Time from "../../components/Time";
import { getFrontMatter } from "../../lib/helpers/posts";
import { addMetadata } from "../../lib/helpers/metadata";
import { createMetadata } from "../../lib/helpers/metadata";
import * as config from "../../lib/config";
import { POSTS_DIR } from "../../lib/config/constants";
import type { ReactElement } from "react";
@@ -9,12 +9,10 @@ import type { FrontMatter } from "../../lib/helpers/posts";
import styles from "./page.module.css";
export const metadata = addMetadata({
export const metadata = createMetadata({
title: "Notes",
description: `Recent posts by ${config.authorName}.`,
alternates: {
canonical: `/${POSTS_DIR}`,
},
canonical: `/${POSTS_DIR}`,
});
const Page = async () => {