Seite läuft wieder, menü bringt keine fehler mehr

This commit is contained in:
Codex Agent
2025-10-07 11:52:03 +02:00
parent 5ee510b05d
commit dd5545605c
33 changed files with 1902 additions and 1361 deletions

View File

@@ -14,27 +14,65 @@ interface Props {
}
const Blog: React.FC<Props> = ({ posts }) => {
const { localizedPath } = useLocalizedRoutes();
const { t } = useTranslation('marketing');
const resolvePaginationHref = React.useCallback(
(raw?: string | null) => {
if (!raw) {
return null;
}
try {
const parsed = new URL(
raw,
typeof window !== 'undefined' ? window.location.origin : 'http://localhost'
);
const normalized = `${parsed.pathname}${parsed.search}`;
return localizedPath(normalized);
} catch (error) {
console.warn('[Marketing Blog] Fallback resolving pagination link', { raw, error });
return localizedPath(raw);
}
},
[localizedPath]
);
const renderPagination = () => {
if (!posts.links || posts.links.length <= 3) return null;
return (
<div className="mt-12 text-center">
<div className="flex justify-center space-x-2">
{posts.links.map((link, index) => (
<Link
key={index}
href={link.url || '#'}
className={`px-3 py-2 rounded ${
link.active
? 'bg-[#FFB6C1] text-white'
: 'bg-gray-200 text-gray-700 hover:bg-gray-300'
}`}
dangerouslySetInnerHTML={{ __html: link.label }}
/>
))}
{posts.links.map((link, index) => {
const href = resolvePaginationHref(link.url);
const baseClasses = `px-3 py-2 rounded ${
link.active
? 'bg-[#FFB6C1] text-white'
: 'bg-gray-200 text-gray-700 hover:bg-gray-300'
}`;
if (!href) {
return (
<span
key={index}
className={`${baseClasses} cursor-default`}
dangerouslySetInnerHTML={{ __html: link.label }}
/>
);
}
return (
<Link
key={index}
href={href}
className={baseClasses}
dangerouslySetInnerHTML={{ __html: link.label }}
/>
);
})}
</div>
</div>
);