Famous people: admin page, own prompt, one photo, public pages
CI / test (push) Successful in 2m21s
CI / build (push) Skipped
CI / deploy (push) Skipped

- 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
This commit is contained in:
feco
2026-11-22 16:08:35 +00:00
co-authored by Claude Opus 5.5
parent 13e22a9c7d
commit 37cb0abf4b
47 changed files with 3008 additions and 77 deletions
@@ -0,0 +1,29 @@
// The link preview image of a famous person (og:image): the photo with the
// face in view, the name and the chart. The file name carries a version (see
// `celebrityImageVersion`), so a new photo or face point gets a new address.
import { SIGNS, signName } from "@/lib/astro";
import { loadCelebrity } from "@/lib/celebrities";
import { celebrityCard } from "@/lib/ogCard";
import { BACKEND_URL } from "@/lib/server";
import { bigThree } from "@/lib/share";
export async function GET(_req: Request, { params }: { params: Promise<{ slug: string; file: string }> }) {
const { slug } = await params;
const c = await loadCelebrity(slug);
if (!c) return new Response("Not found", { status: 404 });
let photo = null;
if (c.photo) {
const res = await fetch(`${BACKEND_URL}/v1/public/photos/${c.photo.key}`, { cache: "no-store" });
if (res.ok) photo = { ...c.photo, data: await res.arrayBuffer() };
}
return celebrityCard({
chart: c.chart,
timeKnown: c.chart.time_known,
name: c.name,
subtitle: c.subtitle,
lines: bigThree(c.chart).map((t) => ({ glyph: SIGNS[t.sign]?.glyph ?? "", label: `${t.label} ${signName(t.sign)}` })),
photo,
// A draft's image is not kept anywhere.
cacheControl: c.published ? "public, max-age=3600, s-maxage=86400" : "private, no-store",
});
}
@@ -0,0 +1,141 @@
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 />
</>
);
}
@@ -0,0 +1,86 @@
import type { Metadata } from "next";
import Image from "next/image";
import Link from "next/link";
import { PublicFooter } from "@/components/PublicFooter";
import { PublicHeader } from "@/components/SiteHeader";
import { SIGNS, signName } from "@/lib/astro";
import { loadCelebrities } from "@/lib/celebrities";
import { objectPosition, photoSrc } from "@/lib/celebrityPhoto";
import { getMe } from "@/lib/server";
export const metadata: Metadata = {
title: "Híres emberek horoszkópja",
description:
"Híres emberek születési képlete és részletes asztrológiai portréja: Nap, Hold, Aszcendens és a képlet teljes értelmezése.",
alternates: { canonical: "/hires-emberek" },
};
/** The published famous people. */
export default async function CelebritiesPage() {
const [people, me] = await Promise.all([loadCelebrities(), getMe()]);
return (
<>
{!me && <PublicHeader />}
<main className="page" style={{ maxWidth: 1080 }}>
<div className="page-head">
<span className="eyebrow">Híres emberek</span>
<h1>Híres emberek horoszkópja</h1>
<p className="muted">
Ismert emberek születési képlete és részletes portréja. A szöveg csak a képletből dolgozik, nem az
életrajzukból: azt mutatja meg, mit árul el róluk a születésük pillanatának égboltja.
</p>
</div>
{people.length === 0 ? (
<p className="muted">Hamarosan.</p>
) : (
<ul className="celeb-grid">
{people.map((p) => (
<li key={p.id}>
<Link href={`/hires-emberek/${p.slug}`} className="card celeb-tile">
<span className="celeb-tile-photo">
{p.photo ? (
<Image
src={photoSrc(p.photo)}
alt={p.name}
fill
sizes="(max-width: 640px) 50vw, 240px"
style={{ objectFit: "cover", objectPosition: objectPosition(p.photo) }}
/>
) : (
<span className="celeb-tile-glyph" aria-hidden="true">
{p.highlights.sun ? SIGNS[p.highlights.sun]?.glyph : "✶"}
</span>
)}
</span>
<strong>{p.name}</strong>
{p.subtitle && <span className="hint">{p.subtitle}</span>}
<span className="hint">
{[
p.highlights.sun && `Nap ${signName(p.highlights.sun)}`,
p.highlights.moon && `Hold ${signName(p.highlights.moon)}`,
]
.filter(Boolean)
.join(" · ")}
</span>
</Link>
</li>
))}
</ul>
)}
<div className="card sign-cta" style={{ marginTop: 32 }}>
<p style={{ margin: 0 }}>
Kíváncsi vagy a saját képletedre? Az ingyenes születési horoszkóp a születési adataidból kiszámolja, belépés
nélkül.
</p>
<div className="form-actions">
<Link href="/szuletesi-horoszkop" className="btn btn-primary">
Ingyenes születési horoszkóp
</Link>
</div>
</div>
</main>
<PublicFooter />
</>
);
}