Fix FAQFull: Use isDraft boolean for draft filtering, fix Kontakt ID override

This commit is contained in:
MichalC
2026-09-16 12:31:19 +02:00
parent 437e1e4823
commit 9043301da6
140 changed files with 23337 additions and 724 deletions
@@ -11,14 +11,6 @@ import type { Page } from '../../../../payload-types'
type FAQFullBlock = Extract<NonNullable<Page['layout']>[0], { blockType: 'faqFull' }>
const PLACEHOLDER_PL = "Odpowiedź w przygotowaniu"
const PLACEHOLDER_DE = "Antwort in Vorbereitung"
function isPlaceholder(answer: string | null | undefined): boolean {
if (!answer) return true;
return answer.includes(PLACEHOLDER_PL) || answer.includes(PLACEHOLDER_DE) || answer.includes('DO POTWIERDZENIA');
}
export default async function Page(props: {
params: Promise<{ locale: string; slug?: string[] }>
}) {
@@ -62,7 +54,7 @@ export default async function Page(props: {
let faqSchema: Record<string, any> | null = null;
const faqBlock = layout.find((b: any) => b.blockType === 'faqFull') as FAQFullBlock | undefined;
if (faqBlock && faqBlock.questions) {
const validQuestions = faqBlock.questions.filter((q: any) => !isPlaceholder(q.answer));
const validQuestions = faqBlock.questions.filter((q: any) => !q.isDraft);
if (validQuestions.length > 0) {
faqSchema = {
"@context": "https://schema.org",