Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 88 additions & 5 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<script
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: JSON.stringify(jsonLd),
}}
/>
);
}

// ----------------------
// Root Layout
// ----------------------
export default function RootLayout({
children,
}: Readonly<{
}: {
children: React.ReactNode;
}>) {
}) {
return (
<html lang="en">
<body className={`${geistSans.variable} ${geistMono.variable} antialiased`}>
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
<Providers>
<Nav />
{children}
<JsonLd />
</Providers>
</body>
</html>
Expand Down
16 changes: 16 additions & 0 deletions app/sitemap.xml/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { NextResponse } from 'next/server';

export async function GET() {
const baseUrl =
process.env.NEXT_PUBLIC_SITE_URL ?? process.env.NEXTAUTH_URL ?? 'http://localhost:3000';
const routes = ['/', '/clients', '/invoices', '/dashboard', '/login', '/timer'];
const urls = routes
.map((p) => `<url><loc>${baseUrl}${p}</loc><changefreq>weekly</changefreq></url>`)
.join('');
const xml = `<?xml version="1.0" encoding="UTF-8"?>` +
`<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">${urls}</urlset>`;

return new NextResponse(xml, {
headers: { 'Content-Type': 'application/xml' },
});
}
Loading