aboutsummaryrefslogtreecommitdiff
path: root/src/utils/schemas/websiteSchema.ts
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-04-22 19:11:58 +0300
committerValentin Popov <valentin@popov.link>2026-04-22 19:11:58 +0300
commit5e818d804d5d38beff0f3754a006333752fd5082 (patch)
tree7f2d1097390bbdb3c5fa1593f6d15d6dfb3b0dd8 /src/utils/schemas/websiteSchema.ts
parent41bb3099660b6210a419c4190a1bc08d7ba58c00 (diff)
downloadpopov.link-5e818d804d5d38beff0f3754a006333752fd5082.tar.xz
popov.link-5e818d804d5d38beff0f3754a006333752fd5082.zip
refactor: update schema handling and improve SEO metadata
- Changed schema type from WithContext<Thing> to Thing[] in Head, BaseLayout, and JsonLd components for better flexibility. - Added optional robots meta tag to Head component. - Updated JSON-LD generation in JsonLd component to include a structured payload. - Enhanced page and blog schemas to support breadcrumb and person schemas for improved SEO. - Introduced new utility schemas for website and person to streamline schema generation. - Refactored existing schemas to align with the new structure and ensure consistency across components.
Diffstat (limited to 'src/utils/schemas/websiteSchema.ts')
-rw-r--r--src/utils/schemas/websiteSchema.ts23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/utils/schemas/websiteSchema.ts b/src/utils/schemas/websiteSchema.ts
new file mode 100644
index 0000000..2f69427
--- /dev/null
+++ b/src/utils/schemas/websiteSchema.ts
@@ -0,0 +1,23 @@
+import type { WebSite } from "schema-dts";
+import { config } from "../../config";
+import { personId, websiteId } from "./ids";
+
+export type WebsiteSchemaParams = {
+ readonly description: string;
+ readonly lang: string;
+ readonly name: string;
+ readonly siteUrl: string;
+};
+
+export default ({ siteUrl, name, description, lang }: WebsiteSchemaParams): WebSite => ({
+ "@type": "WebSite",
+ "@id": websiteId(siteUrl),
+ "url": siteUrl,
+ "name": name,
+ "description": description,
+ "inLanguage": lang,
+ "publisher": { "@id": personId(siteUrl) },
+ "author": { "@id": personId(siteUrl) },
+ "copyrightHolder": { "@id": personId(siteUrl) },
+ "sameAs": config.author.sameAs,
+});