feat(seo): add metadata, sitemap, robots, JSON-LD, dynamic OG image

- Centralize brand/keyword config in lib/site.ts (slogan, 22 keywords).
- Root layout: metadataBase, title template, OG/Twitter defaults, robots rules.
- Per-page metadata: home, trips list (filter-aware), trip detail, profile (noindex).
- Layout wrappers add metadata to client-component pages: login, register, create-trip.
- Trip detail: generateMetadata + JSON-LD Event + BreadcrumbList (price, availability, rating).
- Home page: JSON-LD Organization + WebSite + SearchAction (sitelink search).
- app/sitemap.ts: dynamic sitemap pulling OPEN/FULL trips from Prisma.
- app/robots.ts: disallow /api/, /profile, /create-trip; references sitemap.
- app/trips/[id]/opengraph-image.tsx: dynamic 1200x630 OG image per trip with
  cover photo, title, mountain, date, price, brand badge.
- Seeder: switch trip images from local SVG placeholders to real Unsplash CDN URLs.
- Drop 18 obsolete seed SVGs from public/images/seed/.

New env: NEXT_PUBLIC_SITE_URL (defaults to localhost:3000) — set to prod domain on deploy.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
arifal
2026-04-27 02:14:08 +07:00
parent a4508dc828
commit d91e16b6ef
31 changed files with 657 additions and 255 deletions
+46
View File
@@ -1,7 +1,20 @@
import type { Metadata } from "next";
import Link from "next/link";
import Image from "next/image";
import { tripService } from "@/server/services/trip.service";
import { TripCard } from "@/features/trip/components/trip-card";
import { siteConfig, siteUrl, absoluteUrl } from "@/lib/site";
export const metadata: Metadata = {
title: "Cari Open Trip Pendakian Gunung Bareng",
description: `${siteConfig.slogan} ${siteConfig.description}`,
alternates: { canonical: "/" },
openGraph: {
title: `${siteConfig.name} — Open Trip Pendakian Gunung Bareng`,
description: siteConfig.slogan,
url: "/",
},
};
export default async function HomePage() {
const trips = await tripService.getOpenTrips();
@@ -25,8 +38,41 @@ export default async function HomePage() {
.filter((t) => !shownIds.has(t.id) && t.price <= 300000)
.slice(0, 3);
const orgJsonLd = {
"@context": "https://schema.org",
"@graph": [
{
"@type": "Organization",
"@id": `${siteUrl}/#organization`,
name: siteConfig.name,
url: siteUrl,
logo: absoluteUrl("/images/SeTrip.png"),
slogan: siteConfig.slogan,
description: siteConfig.description,
},
{
"@type": "WebSite",
"@id": `${siteUrl}/#website`,
url: siteUrl,
name: siteConfig.name,
description: siteConfig.description,
publisher: { "@id": `${siteUrl}/#organization` },
inLanguage: "id-ID",
potentialAction: {
"@type": "SearchAction",
target: `${siteUrl}/trips?q={search_term_string}`,
"query-input": "required name=search_term_string",
},
},
],
};
return (
<div className="relative min-h-screen bg-neutral-50">
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify(orgJsonLd) }}
/>
{/* ========== HERO ========== */}
<section className="relative overflow-hidden bg-neutral-900">
{/* Logo background full */}