Public sign calculator and the twelve sign pages, SEO basics
CI / test (push) Successful in 1m39s
CI / build (push) Successful in 5m50s
CI / deploy (push) Skipped

/aszcendens-kalkulator: Sun, Moon and Ascendant signs from birth data
without an account. A calculation only (no AI, nothing saved), limited to
30 calculations and 300 place searches an hour per visitor address
(POST /v1/public/signs, GET /v1/public/geo/*). Without a birth time there
is no Ascendant, and signs near a border are marked uncertain.

/csillagjegyek and /csillagjegyek/{jegy}: the twelve signs with facts,
Sun, Moon and Ascendant, love, work, a common misbelief and an offer,
each written on its own. Links to the calculator and sign-up.

SEO: metadataBase and canonical addresses, hreflang between the
Hungarian and English privacy pages, Organization and WebSite JSON-LD on
the home page, FAQPage on the calculator, BreadcrumbList on the sign
pages; the sitemap lists the new pages, the footers link them.

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-21 20:31:45 +00:00
co-authored by Claude Opus 5.5
parent 0cd880b418
commit 2eea1042a5
22 changed files with 1395 additions and 47 deletions
+19 -40
View File
@@ -4,6 +4,7 @@ import { useEffect, useId, useMemo, useRef, useState } from "react";
import { ApiError, api, errorText } from "@/lib/api";
import { countryName } from "@/lib/astro";
import { MONTHS, composeDate, composeTime, daysIn } from "@/lib/birth";
import type { BirthData, Country, Place } from "@/lib/types";
type Initial = (BirthData & { placeName: string | null; region: string | null }) | null;
@@ -16,41 +17,6 @@ const ERRORS: Record<string, string> = {
invalid_date: "Érvénytelen dátum.",
};
const MONTHS = [
"január",
"február",
"március",
"április",
"május",
"június",
"július",
"augusztus",
"szeptember",
"október",
"november",
"december",
];
const pad = (n: number) => String(n).padStart(2, "0");
const daysIn = (year: number, month: number) => new Date(Date.UTC(year || 2000, month, 0)).getUTCDate();
/** "YYYY-MM-DD" from the three fields, or null while it is not a real date. */
function composeDate(year: string, month: string, day: string): string | null {
const y = Number(year);
const m = Number(month);
const d = Number(day);
if (!/^\d{4}$/.test(year) || y < 1000 || !m || !d || d > daysIn(y, m)) return null;
return `${year}-${pad(m)}-${pad(d)}`;
}
/** "HH:MM" from the two fields, or null while it is not a real time. */
function composeTime(hour: string, minute: string): string | null {
if (!/^\d{1,2}$/.test(hour) || !/^\d{1,2}$/.test(minute)) return null;
const h = Number(hour);
const m = Number(minute);
return h <= 23 && m <= 59 ? `${pad(h)}:${pad(m)}` : null;
}
/** Someone else's chart: added with a name, or (with `chartId`) corrected. */
export type PersonTarget = { chartId?: string; name?: string };
@@ -314,10 +280,21 @@ export function BirthForm({
);
}
export function CountrySelect({ value, onChange }: { value: string; onChange: (iso2: string) => void }) {
/** Where the country list and the place search come from: logged-in users, or the public calculator. */
export type GeoBase = "/api/geo" | "/api/v1/public/geo";
export function CountrySelect({
value,
onChange,
geoBase = "/api/geo",
}: {
value: string;
onChange: (iso2: string) => void;
geoBase?: GeoBase;
}) {
const [countries, setCountries] = useState<Country[]>([]);
useEffect(() => {
fetch("/api/geo/countries")
fetch(`${geoBase}/countries`)
.then((r) => (r.ok ? r.json() : { countries: [] }))
.then((d: { countries: Country[] }) => {
const named = d.countries.map((c) => ({ iso2: c.iso2, name: countryName(c.iso2, c.name) }));
@@ -325,7 +302,7 @@ export function CountrySelect({ value, onChange }: { value: string; onChange: (i
setCountries(named);
})
.catch(() => setCountries([]));
}, []);
}, [geoBase]);
return (
<div className="field">
<label htmlFor="birth-country">Ország</label>
@@ -345,10 +322,12 @@ export function PlaceSearch({
country,
value,
onChange,
geoBase = "/api/geo",
}: {
country: string;
value: Place | null;
onChange: (p: Place | null) => void;
geoBase?: GeoBase;
}) {
const listId = useId();
const [query, setQuery] = useState(value?.name ?? "");
@@ -377,7 +356,7 @@ export function PlaceSearch({
setLoading(true);
const timer = setTimeout(async () => {
try {
const res = await fetch(`/api/geo/places?country=${country}&q=${encodeURIComponent(q)}&limit=8`);
const res = await fetch(`${geoBase}/places?country=${country}&q=${encodeURIComponent(q)}&limit=8`);
const data = res.ok ? ((await res.json()) as { places: Place[] }) : { places: [] };
if (id === seq.current) {
setResults(data.places);
@@ -391,7 +370,7 @@ export function PlaceSearch({
}
}, 250);
return () => clearTimeout(timer);
}, [query, country, value]);
}, [query, country, value, geoBase]);
function choose(p: Place) {
onChange(p);