Public gift pages for visitors and search engines
- /ajandek shows a page about giving to visitors (indexable, in the sitemap); the form still needs a login. - A gift band on the home page and "Ajándékozás" in the footer (to /karacsony in the Christmas season). - A link preview image for /karacsony. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -1,26 +1,50 @@
|
||||
import type { Metadata } from "next";
|
||||
import Link from "next/link";
|
||||
|
||||
import { GiftLanding } from "@/components/GiftLanding";
|
||||
import { PublicHeader } from "@/components/SiteHeader";
|
||||
import { payMethod } from "@/lib/payments";
|
||||
import { isChristmasTime } from "@/lib/season";
|
||||
import { backendGet, requireMe } from "@/lib/server";
|
||||
import { backendGet, getMe } from "@/lib/server";
|
||||
import { siteUrl } from "@/lib/share";
|
||||
import type { Gift, Package, PublicConfig } from "@/lib/types";
|
||||
|
||||
import { GiftForm } from "./GiftForm";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Ajándék csomag",
|
||||
robots: { index: false },
|
||||
};
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const base = await siteUrl();
|
||||
const title = "Horoszkóp ajándékba";
|
||||
const description =
|
||||
"Ajándékozz születési képletet, személyre szóló elemzést és éves előrejelzést. Nyomtatható utalvány, e-mailben időzítve vagy személyesen átadva.";
|
||||
return {
|
||||
title,
|
||||
description,
|
||||
alternates: { canonical: `${base}/ajandek` },
|
||||
openGraph: { type: "website", siteName: "Sorsfonalak", locale: "hu_HU", url: `${base}/ajandek`, title, description },
|
||||
};
|
||||
}
|
||||
|
||||
type Props = { searchParams: Promise<{ csomag?: string }> };
|
||||
|
||||
/** Buying a package as a gift; `?csomag=` picks the package (links on the package cards). */
|
||||
export default async function GiftPage({ searchParams }: Props) {
|
||||
const { csomag } = await searchParams;
|
||||
const me = await requireMe(
|
||||
csomag ? `/ajandek?csomag=${encodeURIComponent(csomag)}` : "/ajandek",
|
||||
);
|
||||
const me = await getMe();
|
||||
if (!me) {
|
||||
// Visitors (and search engines) get the page about giving; the form needs a login.
|
||||
const catalog = await backendGet<{ packages: Package[] }>("/v1/packages");
|
||||
return (
|
||||
<>
|
||||
<PublicHeader />
|
||||
<GiftLanding
|
||||
packages={(catalog?.packages ?? []).filter((p) => p.tier === "main")}
|
||||
loggedIn={false}
|
||||
christmas={false}
|
||||
season={isChristmasTime()}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
const [catalog, config, mine] = await Promise.all([
|
||||
backendGet<{ packages: Package[] }>("/v1/packages"),
|
||||
backendGet<PublicConfig>("/v1/config"),
|
||||
|
||||
Reference in New Issue
Block a user