Integrate Prisma for content; enhance SEO, i18n, and deployment workflows

Co-authored-by: dennis <dennis@konkol.net>
This commit is contained in:
Cursor Agent
2026-01-12 15:27:35 +00:00
parent f1cc398248
commit 423a2af938
38 changed files with 757 additions and 629 deletions

30
lib/seo.ts Normal file
View File

@@ -0,0 +1,30 @@
import { locales, type AppLocale } from "@/i18n/locales";
export function getBaseUrl(): string {
const raw =
process.env.NEXT_PUBLIC_BASE_URL ||
process.env.NEXTAUTH_URL || // fallback if ever added
"http://localhost:3000";
return raw.replace(/\/+$/, "");
}
export function toAbsoluteUrl(path: string): string {
const base = getBaseUrl();
const normalized = path.startsWith("/") ? path : `/${path}`;
return `${base}${normalized}`;
}
export function getLanguageAlternates(opts: {
/** Path without locale prefix, e.g. "/projects" or "/projects/my-slug" or "" */
pathWithoutLocale: string;
}): Record<AppLocale, string> {
const path = opts.pathWithoutLocale === "" ? "" : `/${opts.pathWithoutLocale}`.replace(/\/{2,}/g, "/");
const normalizedPath = path === "/" ? "" : path;
return locales.reduce((acc, l) => {
const url = toAbsoluteUrl(`/${l}${normalizedPath}`);
acc[l] = url;
return acc;
}, {} as Record<AppLocale, string>);
}