openGraph image creator added
This commit is contained in:
parent
bd1dbe42f9
commit
56a97b1ae5
@ -13,7 +13,8 @@ export const metadata: Metadata = {
|
||||
template: "%s | parsa aghayi",
|
||||
default: "parsa aghayi",
|
||||
},
|
||||
description: "parsa aghayi personal website",
|
||||
description: "parsa aghayi's personal website",
|
||||
images: ["/og-image?text=parsa aghayi's personal website"],
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@ -13,9 +13,9 @@ export const metadata: Metadata = {
|
||||
description:
|
||||
"Hi, I am parsa aghayi. Frontend & Backend Developer and here is my personal website to know me and contact me if you want! ;)",
|
||||
openGraph: {
|
||||
title: "parsa aghayi's personal website openGraph title",
|
||||
title: "parsa aghayi's personal website",
|
||||
description:
|
||||
"Hi, I am parsa aghayi. Frontend & Backend Developer and here is my personal website to know me and contact me if you want! ;) openGraph description",
|
||||
"Hi, I am parsa aghayi. Frontend & Backend Developer and here is my personal website to know me and contact me if you want! ;)",
|
||||
images: ["/images/profile.png"],
|
||||
},
|
||||
};
|
||||
|
||||
@ -13,6 +13,12 @@ export const metadata: Metadata = {
|
||||
title: "All Categories List",
|
||||
description:
|
||||
"Browse through our collection of categories to find posts on your favorite topics. Whether you`re looking for insightful articles, how-tos, or the latest trends, our categories make it easy to discover content tailored to your interests.",
|
||||
openGraph: {
|
||||
title: "All Categories List",
|
||||
description:
|
||||
"Browse through our collection of categories to find posts on your favorite topics. Whether you`re looking for insightful articles, how-tos, or the latest trends, our categories make it easy to discover content tailored to your interests.",
|
||||
images: ["/og-image?text=All Categories List"],
|
||||
},
|
||||
};
|
||||
|
||||
export default async function Categories({ searchParams }: categoryPropsType) {
|
||||
|
||||
@ -15,6 +15,7 @@ export const metadata: Metadata = {
|
||||
openGraph: {
|
||||
title: "",
|
||||
description: "",
|
||||
images: ["/og-image?text=filtered posts"],
|
||||
},
|
||||
};
|
||||
|
||||
@ -37,6 +38,9 @@ export default async function FilteredPosts({
|
||||
? (metadata.openGraph.description =
|
||||
"New Browse through our collection of categories to find posts on your favorite topics. Whether you`re looking for insightful articles, how-tos, or the latest trends, our categories make it easy to discover content tailored to your interests.")
|
||||
: "";
|
||||
metadata.openGraph
|
||||
? (metadata.openGraph.images = ["/og-image?text=All New Posts List"])
|
||||
: [];
|
||||
break;
|
||||
case "popular":
|
||||
filteredPostApiUrl = "/posts?sort_field=views&sort_direction=desc";
|
||||
@ -50,6 +54,11 @@ export default async function FilteredPosts({
|
||||
? (metadata.openGraph.description =
|
||||
"Popular Browse through our collection of categories to find posts on your favorite topics. Whether you`re looking for insightful articles, how-tos, or the latest trends, our categories make it easy to discover content tailored to your interests.")
|
||||
: "";
|
||||
metadata.openGraph
|
||||
? (metadata.openGraph.images = [
|
||||
"/og-image?text=All Popular Posts List",
|
||||
])
|
||||
: [];
|
||||
break;
|
||||
default:
|
||||
// code block
|
||||
|
||||
@ -14,7 +14,7 @@ export const metadata: Metadata = {
|
||||
default: "parsa aghayi's blog",
|
||||
},
|
||||
description: "parsa aghayi personal blog",
|
||||
images: ["/images/favicons/blog-icon.png"],
|
||||
images: ["/og-image?text=parsa aghayi's personal blog"],
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
33
src/app/(routes)/og-image/route.tsx
Normal file
33
src/app/(routes)/og-image/route.tsx
Normal file
@ -0,0 +1,33 @@
|
||||
import { ImageResponse } from "next/og";
|
||||
|
||||
export const runtime = "edge";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const { searchParams } = new URL(request.url);
|
||||
const text = searchParams.get("text") || "Hello world!";
|
||||
|
||||
return new ImageResponse(
|
||||
(
|
||||
<div
|
||||
style={{
|
||||
fontSize: 128,
|
||||
background: "rgb(110 100 260)",
|
||||
color: "white",
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
display: "flex",
|
||||
textAlign: "center",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
textTransform: "capitalize",
|
||||
}}
|
||||
>
|
||||
{text}
|
||||
</div>
|
||||
),
|
||||
{
|
||||
width: 1200,
|
||||
height: 1200,
|
||||
},
|
||||
);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user