|
1 | 1 | import type { Metadata } from "next/types";
|
2 | 2 |
|
3 |
| -export function createMetadata(override: Metadata): Metadata { |
| 3 | +const defaultMetadata: Metadata = { |
| 4 | + title: "Hiro Docs", |
| 5 | + description: |
| 6 | + "All the developer docs, guides and resources you need to build on Bitcoin layers.", |
| 7 | + openGraph: { |
| 8 | + title: "Hiro Docs", |
| 9 | + description: |
| 10 | + "All the developer docs, guides and resources you need to build on Bitcoin layers.", |
| 11 | + url: "https://docs.hiro.so", |
| 12 | + siteName: "Hiro Docs", |
| 13 | + images: [ |
| 14 | + { |
| 15 | + url: "/og.jpg", |
| 16 | + width: 800, |
| 17 | + height: 600, |
| 18 | + }, |
| 19 | + ], |
| 20 | + locale: "en_US", |
| 21 | + type: "website", |
| 22 | + }, |
| 23 | + twitter: { |
| 24 | + card: "summary_large_image", |
| 25 | + title: "Hiro Docs", |
| 26 | + description: |
| 27 | + "All the developer docs, guides and resources you need to build on Bitcoin layers.", |
| 28 | + creator: "@hirosystems", |
| 29 | + images: ["/og.jpg"], |
| 30 | + }, |
| 31 | +}; |
| 32 | + |
| 33 | +const hiroHacksMetadata: Partial<Metadata> = { |
| 34 | + title: "Hiro Hacks - Season 1", |
| 35 | + description: |
| 36 | + "Join Hiro Hacks Season 1 and build on Bitcoin layers with our monthly themed challenges.", |
| 37 | + openGraph: { |
| 38 | + title: "Hiro Hacks - Season 1", |
| 39 | + description: |
| 40 | + "Join Hiro Hacks Season 1 and build on Bitcoin layers with our monthly themed challenges.", |
| 41 | + images: [ |
| 42 | + { |
| 43 | + url: "/images/hiro-hacks-season-one.png", |
| 44 | + width: 800, |
| 45 | + height: 600, |
| 46 | + }, |
| 47 | + ], |
| 48 | + }, |
| 49 | + twitter: { |
| 50 | + title: "Hiro Hacks - Season 1", |
| 51 | + description: |
| 52 | + "Join Hiro Hacks Season 1 and build on Bitcoin layers with our monthly themed challenges.", |
| 53 | + images: ["/images/hiro-hacks-season-one.png"], |
| 54 | + }, |
| 55 | +}; |
| 56 | + |
| 57 | +export function createMetadata(override: Partial<Metadata>): Metadata { |
4 | 58 | return {
|
| 59 | + ...defaultMetadata, |
5 | 60 | ...override,
|
| 61 | + openGraph: { |
| 62 | + ...defaultMetadata.openGraph, |
| 63 | + ...override.openGraph, |
| 64 | + }, |
| 65 | + twitter: { |
| 66 | + ...defaultMetadata.twitter, |
| 67 | + ...override.twitter, |
| 68 | + }, |
6 | 69 | };
|
7 | 70 | }
|
8 | 71 |
|
9 | 72 | export const baseUrl =
|
10 | 73 | process.env.NODE_ENV === "development"
|
11 | 74 | ? new URL("http://localhost:3000")
|
12 | 75 | : new URL(`https://${process.env.NEXT_PUBLIC_VERCEL_URL!}`);
|
| 76 | + |
| 77 | +export function getRouteMetadata(path: string): Partial<Metadata> { |
| 78 | + if (path.startsWith("/stacks/hacks")) { |
| 79 | + return hiroHacksMetadata; |
| 80 | + } |
| 81 | + return {}; |
| 82 | +} |
0 commit comments