From 62f1e9a89cd81d7793be510b781407d6e9e99a4f Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Fri, 27 Feb 2026 12:55:24 +0100 Subject: [PATCH] fix: resolve html invalid nesting, english routing 404s, and nodemailer missing credentials --- components/PayloadRichText.tsx | 51 +++++++++++++++++++--------------- next-env.d.ts | 2 +- next.config.mjs | 34 +++++++++++++++++++++++ payload.config.ts | 12 +++++--- 4 files changed, 71 insertions(+), 28 deletions(-) diff --git a/components/PayloadRichText.tsx b/components/PayloadRichText.tsx index 52e1fdd3..ce7f5d34 100644 --- a/components/PayloadRichText.tsx +++ b/components/PayloadRichText.tsx @@ -49,11 +49,11 @@ const jsxConverters: JSXConverters = { const startsWithDash = text.trimStart().startsWith('- '); const prefix = startsWithDash ? null : parts.shift(); return ( - <> +
{prefix && ( - +
{!prefix.includes('<') ? prefix : undefined} - +
)}
    {parts.map((item: string, i: number) => { @@ -64,7 +64,7 @@ const jsxConverters: JSXConverters = { return
  • {cleanItem}
  • ; })}
- +
); } @@ -118,10 +118,12 @@ const jsxConverters: JSXConverters = { ); } - if (node.format === 1) return {text}; - if (node.format === 2) return {text}; - return {text}; + if (node.format === 1) return {text}; + if (node.format === 2) return {text}; + return {text}; }, + // Use div instead of p for paragraphs to allow nested block elements (like the lists above) + paragraph: ({ children }: any) =>
{children}
, // Scale headings to prevent multiple H1s (H1 -> H2, etc) h1: ({ children }: any) =>

{children}

, h2: ({ children }: any) =>

{children}

, @@ -170,10 +172,10 @@ const jsxConverters: JSXConverters = { /> ), technicalGrid: ({ node }: any) => ( - + ), 'block-technicalGrid': ({ node }: any) => { - console.log('[PayloadRichText] Rendering block-technicalGrid:', node.fields.title); + if (!node?.fields) return null; return ; }, highlightBox: ({ node }: any) => ( @@ -246,20 +248,23 @@ const jsxConverters: JSXConverters = { {node.fields.title} ), - productTabs: ({ node }: any) => ( - - } - > - <> - - ), + productTabs: ({ node }: any) => { + if (!node?.fields) return null; + return ( + + } + > + <> + + ); + }, 'block-productTabs': ({ node }: any) => ( /// -import "./.next/dev/types/routes.d.ts"; +import "./.next/types/routes.d.ts"; // NOTE: This file should not be edited // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. diff --git a/next.config.mjs b/next.config.mjs index 4a325f98..dc5814df 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -393,6 +393,7 @@ const nextConfig = { }, images: { formats: ['image/webp'], + deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840], remotePatterns: [ { protocol: 'https', @@ -402,6 +403,14 @@ const nextConfig = { protocol: 'https', hostname: '*.klz-cables.com', }, + { + protocol: 'http', + hostname: 'klz-cables.com', + }, + { + protocol: 'http', + hostname: '*.klz-cables.com', + }, { protocol: 'http', hostname: 'klz.localhost', @@ -427,6 +436,31 @@ const nextConfig = { source: '/de/kontakt', destination: '/de/contact', }, + // Safety rewrites for English locale using German slugs (legacy or content errors) + { + source: '/en/produkte', + destination: '/en/products', + }, + { + source: '/en/produkte/:path*', + destination: '/en/products/:path*', + }, + { + source: '/en/kontakt', + destination: '/en/contact', + }, + { + source: '/en/impressum', + destination: '/en/legal-notice', + }, + { + source: '/en/datenschutz', + destination: '/en/privacy-policy', + }, + { + source: '/en/agbs', + destination: '/en/terms', + }, ], afterFiles: [], fallback: [], diff --git a/payload.config.ts b/payload.config.ts index 0ec5067b..289ba29c 100644 --- a/payload.config.ts +++ b/payload.config.ts @@ -86,10 +86,14 @@ export default buildConfig({ transportOptions: { host: process.env.MAIL_HOST || 'smtp.eu.mailgun.org', port: Number(process.env.MAIL_PORT) || 587, - auth: { - user: process.env.MAIL_USERNAME, - pass: process.env.MAIL_PASSWORD, - }, + ...(process.env.MAIL_USERNAME + ? { + auth: { + user: process.env.MAIL_USERNAME, + pass: process.env.MAIL_PASSWORD, + }, + } + : {}), }, }) : undefined,