chore: stabilize pipeline and harden infrastructure
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 9s
Build & Deploy / 🧪 QA (push) Failing after 1m43s
Build & Deploy / 🏗️ Build (push) Has been skipped
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 3s

- Harden E2E smoke tests with increased timeouts and German keyword detection
- Implement defensive body parsing in analytics relay to prevent crashes
- Refine middleware to bypass i18n logic for Server Actions
- Fix date formatting consistency and JsonLd validation
This commit is contained in:
2026-04-12 22:38:59 +02:00
parent 0091b56dd1
commit 64ec24f8b2
9 changed files with 167 additions and 54 deletions

View File

@@ -7,16 +7,14 @@ interface JsonLdProps {
export default function JsonLd({ id, data }: JsonLdProps) {
// If data is provided, use it. Otherwise, use the default Organization + WebSite schema.
const schemaData = data || [
const rawData = data || [
{
'@context': 'https://schema.org',
'@type': 'Organization',
name: 'KLZ Cables',
url: 'https://klz-cables.com',
logo: 'https://klz-cables.com/logo-blue.svg',
sameAs: [
'https://www.linkedin.com/company/klz-cables',
],
sameAs: ['https://www.linkedin.com/company/klz-cables'],
description: 'Premium Cable Solutions for Renewable Energy and Infrastructure.',
address: {
'@type': 'PostalAddress',
@@ -36,15 +34,32 @@ export default function JsonLd({ id, data }: JsonLdProps) {
},
'query-input': 'required name=search_term_string',
},
}
},
];
// Harden schema items: Ensure each item is an object and has @context
const schemaData = (Array.isArray(rawData) ? rawData : [rawData])
.filter((item): item is WithContext<Thing> => {
// Basic sanity check: must be an object and not null
return typeof item === 'object' && item !== null;
})
.map((item) => {
// Ensure @context is present and correctly typed for consumer libraries
if (!item['@context']) {
return {
...item,
'@context': 'https://schema.org',
};
}
return item;
});
return (
<script
id={id}
type="application/ld+json"
dangerouslySetInnerHTML={{
__html: JSON.stringify(schemaData),
__html: JSON.stringify(schemaData.length === 1 ? schemaData[0] : schemaData),
}}
/>
);

View File

@@ -74,11 +74,14 @@ export default async function RecentPosts({ locale, data }: RecentPostsProps) {
suppressHydrationWarning
className="px-3 py-1 text-white/80 text-[10px] md:text-xs font-bold uppercase tracking-widest border border-white/20 rounded-full bg-white/10 backdrop-blur-md"
>
{new Date(post.frontmatter.date).toLocaleDateString(locale || 'de', {
year: 'numeric',
month: 'short',
day: 'numeric',
})}
{new Date(post.frontmatter.date).toLocaleDateString(
locale === 'en' ? 'en-US' : 'de-DE',
{
year: 'numeric',
month: 'short',
day: 'numeric',
},
)}
</time>
{(new Date(post.frontmatter.date) > new Date() ||
post.frontmatter.public === false) && (