From 9745ffd63cfe82f274fd2fa817d203e81e5092fd Mon Sep 17 00:00:00 2001 From: Graeme Date: Fri, 10 Apr 2026 17:52:23 +0200 Subject: [PATCH] improve seo with opengraph and structured data --- app/layout.tsx | 93 +++++++++++++++++++++++++++++++++++++--- app/sitemap.xml/route.ts | 16 +++++++ 2 files changed, 104 insertions(+), 5 deletions(-) create mode 100644 app/sitemap.xml/route.ts diff --git a/app/layout.tsx b/app/layout.tsx index c743453..82fa07c 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -14,22 +14,105 @@ const geistMono = Geist_Mono({ subsets: ['latin'], }); +const siteUrl = + process.env.NEXT_PUBLIC_SITE_URL ?? + process.env.NEXTAUTH_URL ?? + "http://localhost:3000"; + export const metadata: Metadata = { - title: 'Worklog', - description: 'Generated by create next app', + title: { + default: "Worklog", + template: "%s | Worklog", + }, + description: "Track Your Billable Hours", + + metadataBase: new URL(siteUrl), + + openGraph: { + title: "Worklog", + description: "Track Your Billable Hours", + siteName: "Worklog", + type: "website", + locale: "en_US", + url: siteUrl, + images: [ + { + url: `${siteUrl}/og-image.png`, + width: 1200, + height: 630, + alt: "Worklog — Track Your Billable Hours", + }, + ], + }, + + twitter: { + card: "summary_large_image", + title: "Worklog", + description: "Track Your Billable Hours", + images: [`${siteUrl}/og-image.png`], + }, + + icons: { + icon: "/favicon.ico", + apple: "/apple-touch-icon.png", + }, + + alternates: { + canonical: "/", + }, }; +// ---------------------- +// Structured Data (JSON-LD) +// ---------------------- +function JsonLd() { + const jsonLd = { + "@context": "https://schema.org", + "@type": "WebSite", + name: "Worklog", + url: siteUrl, + publisher: { + "@type": "Organization", + name: "Worklog", + url: siteUrl, + logo: { + "@type": "ImageObject", + url: `${siteUrl}/og-image.png`, + }, + sameAs: [ + "https://www.linkedin.com/in/your-profile", + "https://github.com/your-profile", + ], + }, + }; + + return ( +