Improve SEO metadata and structured data
هذا الالتزام موجود في:
256
data/seo.ts
Normal file
256
data/seo.ts
Normal file
@@ -0,0 +1,256 @@
|
||||
import type { Metadata } from "next";
|
||||
import { englishPortfolioContent, getPortfolioContent, sharedProfile, type Language } from "@/data/portfolio";
|
||||
import { absoluteUrl, siteName } from "@/data/site-config";
|
||||
|
||||
const sharedKeywords = [
|
||||
"architecture portfolio",
|
||||
"architectural engineer",
|
||||
"architectural design",
|
||||
"urban rehabilitation",
|
||||
"landscape design",
|
||||
"shop drawings",
|
||||
"architectural visualization",
|
||||
"Damascus architect",
|
||||
];
|
||||
|
||||
const localizedKeywords: Record<Language, string[]> = {
|
||||
en: ["portfolio architect", "presentation boards", "mixed-use towers", "hospitality design"],
|
||||
ar: ["بورتفوليو معماري", "مهندسة معمارية", "تصميم معماري", "إعادة تأهيل عمراني"],
|
||||
};
|
||||
|
||||
function getLocale(language: Language) {
|
||||
return language === "ar" ? "ar_SY" : "en_US";
|
||||
}
|
||||
|
||||
function getAlternateLocales(language: Language) {
|
||||
return language === "ar" ? ["en_US"] : ["ar_SY"];
|
||||
}
|
||||
|
||||
function getOgImage(language: Language) {
|
||||
return {
|
||||
url: absoluteUrl(sharedProfile.heroImage),
|
||||
alt:
|
||||
language === "ar"
|
||||
? "معاينة بورتفوليو غريس بطرس سلمون"
|
||||
: "Portfolio preview for Grace Butrus Salmoun",
|
||||
};
|
||||
}
|
||||
|
||||
function buildMetadata({
|
||||
language,
|
||||
title,
|
||||
description,
|
||||
canonicalPath,
|
||||
pageType,
|
||||
}: {
|
||||
language: Language;
|
||||
title: string;
|
||||
description: string;
|
||||
canonicalPath: string;
|
||||
pageType: "website" | "profile";
|
||||
}): Metadata {
|
||||
const ogImage = getOgImage(language);
|
||||
|
||||
return {
|
||||
title,
|
||||
description,
|
||||
keywords: [...sharedKeywords, ...localizedKeywords[language]],
|
||||
authors: [{ name: sharedProfile.founderNameEn }],
|
||||
creator: sharedProfile.founderNameEn,
|
||||
publisher: sharedProfile.founderNameEn,
|
||||
category: "architecture portfolio",
|
||||
alternates: {
|
||||
canonical: canonicalPath,
|
||||
languages: {
|
||||
en: canonicalPath.includes("/resume") ? "/en/resume" : "/en",
|
||||
ar: canonicalPath.includes("/resume") ? "/ar/resume" : "/ar",
|
||||
"x-default": "/en",
|
||||
},
|
||||
},
|
||||
robots: {
|
||||
index: true,
|
||||
follow: true,
|
||||
googleBot: {
|
||||
index: true,
|
||||
follow: true,
|
||||
"max-image-preview": "large",
|
||||
"max-snippet": -1,
|
||||
"max-video-preview": -1,
|
||||
},
|
||||
},
|
||||
openGraph: {
|
||||
title,
|
||||
description,
|
||||
url: absoluteUrl(canonicalPath),
|
||||
siteName,
|
||||
locale: getLocale(language),
|
||||
alternateLocale: getAlternateLocales(language),
|
||||
type: pageType,
|
||||
images: [ogImage],
|
||||
},
|
||||
twitter: {
|
||||
card: "summary_large_image",
|
||||
title,
|
||||
description,
|
||||
images: [ogImage.url],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function getDefaultSeoMetadata(): Metadata {
|
||||
const title = englishPortfolioContent.meta.title;
|
||||
const description = englishPortfolioContent.meta.description;
|
||||
const ogImage = getOgImage("en");
|
||||
|
||||
return {
|
||||
title,
|
||||
description,
|
||||
applicationName: siteName,
|
||||
authors: [{ name: sharedProfile.founderNameEn }],
|
||||
creator: sharedProfile.founderNameEn,
|
||||
publisher: sharedProfile.founderNameEn,
|
||||
keywords: [...sharedKeywords, ...localizedKeywords.en],
|
||||
category: "architecture portfolio",
|
||||
referrer: "origin-when-cross-origin",
|
||||
robots: {
|
||||
index: true,
|
||||
follow: true,
|
||||
googleBot: {
|
||||
index: true,
|
||||
follow: true,
|
||||
"max-image-preview": "large",
|
||||
"max-snippet": -1,
|
||||
"max-video-preview": -1,
|
||||
},
|
||||
},
|
||||
openGraph: {
|
||||
title,
|
||||
description,
|
||||
url: absoluteUrl("/en"),
|
||||
siteName,
|
||||
locale: "en_US",
|
||||
alternateLocale: ["ar_SY"],
|
||||
type: "website",
|
||||
images: [ogImage],
|
||||
},
|
||||
twitter: {
|
||||
card: "summary_large_image",
|
||||
title,
|
||||
description,
|
||||
images: [ogImage.url],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function getHomeMetadata(language: Language): Metadata {
|
||||
const t = getPortfolioContent(language);
|
||||
|
||||
return buildMetadata({
|
||||
language,
|
||||
title: t.meta.title,
|
||||
description: t.meta.description,
|
||||
canonicalPath: `/${language}`,
|
||||
pageType: "website",
|
||||
});
|
||||
}
|
||||
|
||||
export function getResumeMetadata(language: Language): Metadata {
|
||||
const t = getPortfolioContent(language);
|
||||
const title = language === "ar" ? `السيرة الذاتية | ${t.meta.title}` : `Resume | ${t.meta.title}`;
|
||||
|
||||
return buildMetadata({
|
||||
language,
|
||||
title,
|
||||
description: t.resume.description,
|
||||
canonicalPath: `/${language}/resume`,
|
||||
pageType: "profile",
|
||||
});
|
||||
}
|
||||
|
||||
export function getHomeStructuredData(language: Language) {
|
||||
const t = getPortfolioContent(language);
|
||||
const name = language === "ar" ? sharedProfile.founderNameAr : sharedProfile.founderNameEn;
|
||||
const address = language === "ar" ? sharedProfile.addressAr : sharedProfile.address;
|
||||
|
||||
return [
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "WebSite",
|
||||
name: siteName,
|
||||
url: absoluteUrl("/"),
|
||||
inLanguage: ["en", "ar"],
|
||||
},
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "Person",
|
||||
name,
|
||||
url: absoluteUrl(`/${language}`),
|
||||
image: absoluteUrl(sharedProfile.heroImage),
|
||||
jobTitle: t.ui.architectureEngineer,
|
||||
description: t.meta.description,
|
||||
email: sharedProfile.email,
|
||||
telephone: sharedProfile.phone,
|
||||
address: {
|
||||
"@type": "PostalAddress",
|
||||
addressLocality: address,
|
||||
addressCountry: "SY",
|
||||
},
|
||||
sameAs: [sharedProfile.facebookHref],
|
||||
knowsAbout: [...t.craft.skills.slice(0, 4), ...t.sectors.categories.slice(0, 4)],
|
||||
},
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "CollectionPage",
|
||||
name: t.meta.title,
|
||||
description: t.meta.description,
|
||||
url: absoluteUrl(`/${language}`),
|
||||
inLanguage: language,
|
||||
isPartOf: {
|
||||
"@type": "WebSite",
|
||||
name: siteName,
|
||||
url: absoluteUrl("/"),
|
||||
},
|
||||
about: {
|
||||
"@type": "Person",
|
||||
name,
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
export function getResumeStructuredData(language: Language) {
|
||||
const t = getPortfolioContent(language);
|
||||
const name = language === "ar" ? sharedProfile.founderNameAr : sharedProfile.founderNameEn;
|
||||
const title = language === "ar" ? `السيرة الذاتية | ${name}` : `Resume | ${name}`;
|
||||
|
||||
return [
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "Person",
|
||||
name,
|
||||
url: absoluteUrl(`/${language}`),
|
||||
email: sharedProfile.email,
|
||||
telephone: sharedProfile.phone,
|
||||
image: absoluteUrl(sharedProfile.heroImage),
|
||||
jobTitle: t.ui.architectureEngineer,
|
||||
sameAs: [sharedProfile.facebookHref],
|
||||
},
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "ProfilePage",
|
||||
name: title,
|
||||
description: t.resume.description,
|
||||
url: absoluteUrl(`/${language}/resume`),
|
||||
inLanguage: language,
|
||||
isPartOf: {
|
||||
"@type": "WebSite",
|
||||
name: siteName,
|
||||
url: absoluteUrl("/"),
|
||||
},
|
||||
about: {
|
||||
"@type": "Person",
|
||||
name,
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
8
data/site-config.ts
Normal file
8
data/site-config.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
const FALLBACK_SITE_URL = "https://grace-salamoun-architect.vercel.app";
|
||||
|
||||
export const siteName = "Grace Butrus Salmoun Portfolio";
|
||||
export const siteUrl = (process.env.NEXT_PUBLIC_SITE_URL ?? FALLBACK_SITE_URL).replace(/\/+$/, "");
|
||||
|
||||
export function absoluteUrl(path = "/") {
|
||||
return new URL(path, `${siteUrl}/`).toString();
|
||||
}
|
||||
المرجع في مشكلة جديدة
حظر مستخدم