feat(seo): implement google analytics, sitemap, robots and json-ld structured data

This commit is contained in:
Poyraz Avsever
2026-03-30 11:28:05 +03:00
parent e08b9ae708
commit a23665ee9e
6 changed files with 162 additions and 3 deletions
+82
View File
@@ -0,0 +1,82 @@
const SITE_URL = process.env.NEXT_PUBLIC_SITE_URL || "https://poyrazavsever.com";
export type PersonJsonLdProps = {
name: string;
url?: string;
image?: string;
jobTitle?: string;
sameAs?: string[];
};
export function PersonJsonLd({
name,
url = SITE_URL,
image = `${SITE_URL}/logo/logo.jpeg`,
jobTitle = "Fullstack Developer",
sameAs = [],
}: PersonJsonLdProps) {
const data = {
"@context": "https://schema.org",
"@type": "Person",
name,
url,
image,
jobTitle,
sameAs,
};
return (
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(data) }}
/>
);
}
export type ArticleJsonLdProps = {
title: string;
description: string;
url: string;
image: string;
datePublished: string;
authorName?: string;
};
export function ArticleJsonLd({
title,
description,
url,
image,
datePublished,
authorName = "Poyraz Avsever",
}: ArticleJsonLdProps) {
const data = {
"@context": "https://schema.org",
"@type": "Article",
headline: title,
description,
url,
image: image.startsWith("http") ? image : `${SITE_URL}${image}`,
datePublished,
author: {
"@type": "Person",
name: authorName,
url: SITE_URL,
},
publisher: {
"@type": "Person",
name: authorName,
logo: {
"@type": "ImageObject",
url: `${SITE_URL}/logo/logo.jpeg`,
},
},
};
return (
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(data) }}
/>
);
}