Skip to content

armgit / mapcn

Public Imported from GitHub
0

Beautiful map components. 100% Free, Zero config, one command setup.

TypeScript

update to use default banner for block OG images

Anmol53a4ec9d80e1
diff --git a/src/app/(main)/blocks/[name]/page.tsx b/src/app/(main)/blocks/[name]/page.tsx
index 9298305..3e5fa70 100644
--- a/src/app/(main)/blocks/[name]/page.tsx
+++ b/src/app/(main)/blocks/[name]/page.tsx
@@ -10,6 +10,7 @@ import {
} from "@/components/page-header";
import { Button } from "@/components/ui/button";
import { getBlocksInGridOrder } from "@/lib/blocks";
+import { siteBanner } from "@/lib/metadata";
import { BlockCard } from "../_components/block-card";
import { BlockDisplay } from "../_components/block-display";
@@ -29,12 +30,6 @@ export async function generateMetadata({
if (!block) notFound();
const title = `${block.title} - mapcn`;
- const image = {
- url: `/blocks/${block.name}-dark.jpg`,
- width: 1280,
- height: 800,
- alt: block.title,
- };
return {
title: block.title,
@@ -45,13 +40,13 @@ export async function generateMetadata({
url: "./",
title,
description: block.description,
- images: [image],
+ images: [siteBanner],
},
twitter: {
card: "summary_large_image",
title,
description: block.description,
- images: [image.url],
+ images: [siteBanner.url],
},
};
}
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index c8bec18..1f8c74a 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -1,6 +1,7 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import { SiteAnalytics } from "@/components/site-analytics";
+import { siteBanner } from "@/lib/metadata";
import "@/styles/globals.css";
@@ -69,21 +70,14 @@ export const metadata: Metadata = {
siteName: siteName,
title: "mapcn - Beautiful maps made simple",
description: siteDescription,
- images: [
- {
- url: "/banner.png",
- width: 1200,
- height: 630,
- alt: "mapcn - Beautiful maps, made simple",
- },
- ],
+ images: [siteBanner],
},
twitter: {
card: "summary_large_image",
title: "mapcn - Beautiful maps made simple",
description: siteDescription,
creator: creator,
- images: ["/banner.png"],
+ images: [siteBanner.url],
},
// "./" resolves to each page's own path.
alternates: {
diff --git a/src/lib/metadata.ts b/src/lib/metadata.ts
new file mode 100644
index 0000000..5f5e580
--- /dev/null
+++ b/src/lib/metadata.ts
@@ -0,0 +1,6 @@
+export const siteBanner = {
+ url: "/banner.png",
+ width: 1200,
+ height: 630,
+ alt: "mapcn - Beautiful maps, made simple",
+};