- Admin "Híres emberek": birth data, one photo (S3: DigitalOcean Spaces in production, RustFS in development), a face point that every crop keeps in view, publishing, and a detailed portrait written with its own `celebrity` prompt (third person, by name, from the chart alone). - The photo is stored once (upright JPEG, at most 2000 px, no metadata); next/image makes the sizes from it, so Cloudflare can cache those. - Public list and pages (/hires-emberek), in the sitemap, with a share image showing the face and the chart. - Share images: the wheel's glyphs and numbers are drawn with the card's fonts (inside the SVG image they came out as boxes, on every card). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
142 lines
5.7 KiB
TypeScript
142 lines
5.7 KiB
TypeScript
import type { Metadata } from "next";
|
|
import Image from "next/image";
|
|
import Link from "next/link";
|
|
import { notFound } from "next/navigation";
|
|
|
|
import { AnalysisView } from "@/components/AnalysisView";
|
|
import { ChartWheel, WheelLegend } from "@/components/ChartWheel";
|
|
import { JsonLd, PublicFooter } from "@/components/PublicFooter";
|
|
import { PublicHeader } from "@/components/SiteHeader";
|
|
import { SIGNS, signName } from "@/lib/astro";
|
|
import { birthLine, celebrityImageVersion, loadCelebrity } from "@/lib/celebrities";
|
|
import { objectPosition, photoSrc } from "@/lib/celebrityPhoto";
|
|
import { getMe } from "@/lib/server";
|
|
import { bigThree, plain, shorten, siteUrl } from "@/lib/share";
|
|
|
|
type Props = { params: Promise<{ slug: string }> };
|
|
|
|
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
|
const { slug } = await params;
|
|
const c = await loadCelebrity(slug);
|
|
if (!c) return { title: "Nem található", robots: { index: false } };
|
|
const base = await siteUrl();
|
|
const title = `${c.name} horoszkópja`;
|
|
const summary = c.analysis?.content.summary;
|
|
const description = summary
|
|
? shorten(plain(summary), 200)
|
|
: `${c.name} születési képlete: ${birthLine(c.chart.birth)}.`;
|
|
const url = `${base}/hires-emberek/${c.slug}`;
|
|
const image = { url: `${url}/kep/${celebrityImageVersion(c)}.png`, width: 1200, height: 630, alt: title };
|
|
return {
|
|
title,
|
|
description,
|
|
// A draft (only admins see it) stays out of search engines.
|
|
robots: c.published ? undefined : { index: false, follow: false },
|
|
alternates: { canonical: url },
|
|
openGraph: { type: "article", siteName: "Sorsfonalak", locale: "hu_HU", url, title, description, images: [image] },
|
|
twitter: { card: "summary_large_image", title, description, images: [image.url] },
|
|
};
|
|
}
|
|
|
|
/** A famous person: photo, birth data, chart and the detailed portrait. */
|
|
export default async function CelebrityPage({ params }: Props) {
|
|
const { slug } = await params;
|
|
const [c, me] = await Promise.all([loadCelebrity(slug), getMe()]);
|
|
if (!c) notFound();
|
|
const chart = c.chart;
|
|
const trio = bigThree(chart);
|
|
const base = await siteUrl();
|
|
|
|
return (
|
|
<>
|
|
<JsonLd
|
|
data={{
|
|
"@context": "https://schema.org",
|
|
"@type": "Person",
|
|
name: c.name,
|
|
birthDate: chart.birth.date,
|
|
...(chart.birth.place ? { birthPlace: { "@type": "Place", name: chart.birth.place } } : {}),
|
|
...(c.photo ? { image: `${base}${photoSrc(c.photo)}` } : {}),
|
|
url: `${base}/hires-emberek/${c.slug}`,
|
|
}}
|
|
/>
|
|
{!me && <PublicHeader />}
|
|
<main className="page" style={{ maxWidth: 1180 }}>
|
|
{!c.published && (
|
|
<p className="msg msg-warn" role="status">
|
|
Vázlat: csak az adminok látják. <Link href={`/admin/hires-emberek/${c.id}`}>Szerkesztés</Link>
|
|
</p>
|
|
)}
|
|
<div className="page-head">
|
|
<span className="eyebrow">
|
|
<Link href="/hires-emberek">Híres emberek</Link>
|
|
</span>
|
|
<h1>{c.name} horoszkópja</h1>
|
|
{c.subtitle && <p className="celeb-subtitle">{c.subtitle}</p>}
|
|
<p className="muted">Született: {birthLine(chart.birth)}</p>
|
|
</div>
|
|
|
|
<section className="chart-layout" aria-label={`${c.name} képlete`}>
|
|
<div className="card chart-wheel-card">
|
|
<ChartWheel chart={chart} timeKnown={chart.time_known} />
|
|
<WheelLegend />
|
|
</div>
|
|
<div className="field chart-side">
|
|
<section className="card celeb-portrait" aria-label={c.name}>
|
|
{c.photo && (
|
|
<div className="celeb-photo">
|
|
<Image
|
|
src={photoSrc(c.photo)}
|
|
alt={c.name}
|
|
fill
|
|
priority
|
|
sizes="(max-width: 900px) 100vw, 420px"
|
|
style={{ objectFit: "cover", objectPosition: objectPosition(c.photo) }}
|
|
/>
|
|
</div>
|
|
)}
|
|
{trio.length > 0 && (
|
|
<p className="share-trio">
|
|
{trio.map((t) => (
|
|
<span key={t.label}>
|
|
<span className="sym" aria-hidden="true">
|
|
{SIGNS[t.sign]?.glyph}
|
|
</span>{" "}
|
|
{t.label} {signName(t.sign)}
|
|
</span>
|
|
))}
|
|
</p>
|
|
)}
|
|
{!chart.time_known && (
|
|
<p className="hint">A születési idő nem ismert, ezért a képleten nincsenek házak és Aszcendens.</p>
|
|
)}
|
|
</section>
|
|
<section className="card share-cta">
|
|
<h2>És a te képleted mit mutat?</h2>
|
|
<p className="muted">
|
|
Add meg a születési adataidat, és megkapod a saját képletedet a rövid összefoglalóval együtt, ingyen.
|
|
</p>
|
|
<Link href={me ? "/keplet" : "/szuletesi-horoszkop"} className="btn btn-primary">
|
|
{me ? "A saját képletem" : "Ingyenes születési horoszkóp"}
|
|
</Link>
|
|
</section>
|
|
</div>
|
|
</section>
|
|
|
|
{c.analysis ? (
|
|
<section className="card analysis-card" aria-label={`${c.name} részletes portréja`}>
|
|
<span className="eyebrow">Asztrológiai portré</span>
|
|
<AnalysisView content={c.analysis.content} kind="celebrity" language={c.analysis.language} />
|
|
</section>
|
|
) : (
|
|
<p className="muted">A részletes portré hamarosan elkészül.</p>
|
|
)}
|
|
<p className="hint">
|
|
A portrét mesterséges intelligencia írta, kizárólag a születési képlet alapján, nem az életrajz ismeretében.
|
|
</p>
|
|
</main>
|
|
<PublicFooter />
|
|
</>
|
|
);
|
|
}
|