Reference site SEO: own meta descriptions, fuller demo content; blocksToMarkdown reads section headers

- blocksToMarkdown: the library's section header (heading → ##, then intro; eyebrow
  skipped), intro, quote and bio are content. Pages whose text sat only in a hero
  (archive pages, quote, 404) auto-filled no meta description and fell back to the
  site description; /md and llms-full.txt also missed every section heading.
- legal() template: the placeholder names its page, so unfilled privacy/terms pages
  don't share a description.
- reference: every demo page has its own meta description (pl/en), posts and case
  studies use their excerpt; fuller made-up text on services, contact, quote and
  the archives (all pages >= 150 words); no seeding of allowThemeToggle (its default,
  fillGlobal rewrote it on every run). The two content silences are gone.

ipal-doctor --strict --offline --deep --url: 0/0/0 (4 silenced: 2 permanent,
2 entryList follow-ups of the block-library track). Smoke tests 15/15.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-29 16:38:09 +01:00
co-authored by Claude Opus 5.5
parent dd11bc8146
commit 64ee581098
9 changed files with 172 additions and 37 deletions
+8
View File
@@ -131,6 +131,14 @@ fifteen ready page sections and ten page templates. A new site in one command: `
6. **CookieButton:** it now lifts above the site footer when the footer is in view. A site with its own fixed footer
bar or a button placed by `className`: check it; `avoid={false}` keeps the old fixed position.
### Fixed
- Meta descriptions, `/md` pages and `llms-full.txt` now read the **section header** of blocks
(`header: { heading, intro }` from `buildSectionHeaderField`, every library block) and testimonial `quote`s
(`blocksToMarkdown`). Before, a page whose text sat only in its hero (an archive page, a form page, the 404) got no
auto-filled meta description and fell back to the site description — the same text on several pages, which Google
ignores. **Requires project changes:** none; pages saved before keep their stored description — re-save them (or seed
`meta.description`) to fill an empty one.
## 1.14.6
The release of everything listed under 1.14.5. **1.14.5 was tagged but never published** (its pre-publish test run
-10
View File
@@ -76,11 +76,6 @@ legacy-peer-deps=true
],
"reason": "Approved exception (AGENTS.md → Project decisions): the /design styleguide has its labels in code"
},
"live-seo:duplicate-meta-descriptions-google-ignores-them": {
"off": true,
"until": "2026-11-30",
"reason": "Follow-up for the reference-site track: three pages per language have no own meta description and fall back to the site description; the seed should give each page one"
},
"live-seo:heading-levels-skipped": {
"off": true,
"until": "2026-11-30",
@@ -90,11 +85,6 @@ legacy-peer-deps=true
"off": true,
"until": "2026-11-30",
"reason": "Follow-up for the block-library track: on the archive pages the first image is an entryList card, which is not marked priority"
},
"live-seo:thin-pages-words": {
"off": true,
"until": "2026-11-30",
"reason": "Follow-up for the reference-site track: demo archive and service pages hold fewer than 150 words of made-up content"
}
}
}
+3 -2
View File
@@ -293,8 +293,9 @@ export async function GET(_req: Request, { params }: { params: Promise<{ locale:
How it works under the hood:
- **`blocksToMarkdown(layout)`** — extraction by field-name CONVENTION (heading→`##`,
subheading→`###`, body/content→text/richtext, image→`![]()`, arrays
items/faq/… recursively). Navigation fields (ctaTarget, id, slug) are skipped.
subheading→`###`, body/content/intro/quote/bio/caption→text/richtext, image→`![]()`, arrays
items/faq/… recursively). The section header of every library block (`header: { eyebrow, heading, intro }`,
`buildSectionHeaderField`) leads its block: heading→`##`, then the intro; the eyebrow is left out. Navigation fields (ctaTarget, id, slug) are skipped.
Unusual blocks: `overrides` per blockType.
- **`lexicalToMarkdown(data)`** — a converter for a single richText field (bold, italics,
links, lists, quotes, images). Standalone, no dependency on Payload's MD export
-10
View File
@@ -13,11 +13,6 @@
],
"reason": "Approved exception (AGENTS.md → Project decisions): the /design styleguide has its labels in code"
},
"live-seo:duplicate-meta-descriptions-google-ignores-them": {
"off": true,
"until": "2026-11-30",
"reason": "Follow-up for the reference-site track: three pages per language have no own meta description and fall back to the site description; the seed should give each page one"
},
"live-seo:heading-levels-skipped": {
"off": true,
"until": "2026-11-30",
@@ -27,11 +22,6 @@
"off": true,
"until": "2026-11-30",
"reason": "Follow-up for the block-library track: on the archive pages the first image is an entryList card, which is not marked priority"
},
"live-seo:thin-pages-words": {
"off": true,
"until": "2026-11-30",
"reason": "Follow-up for the reference-site track: demo archive and service pages hold fewer than 150 words of made-up content"
}
}
}
+1 -1
View File
@@ -20,7 +20,7 @@ export async function seedBaseGlobals(seed: Seeder) {
await seed.fillGlobal('company', { email: '[email protected]', name: 'Example Studio' })
await seed.fillGlobal('site-settings', {
// @starter:if themeToggle
allowThemeToggle: true,
// toggle on is the field's default — seeding the default would rewrite it on every run
// @starter:else
//: allowThemeToggle: false,
// @starter:endif
+80 -8
View File
@@ -44,6 +44,7 @@ const SERVICES = [
media: 'facade',
slug: { en: 'residential-architecture', pl: 'architektura-domow' },
text: tx('Zaczynamy od działki: światła, widoków i tego, jak chcesz mieszkać. Dopiero potem rysujemy bryłę. Każdy projekt prowadzi jeden architekt, który odpowiada za całość aż do odbioru.', 'We start with the plot: its light, its views and how you want to live. Only then do we draw the building. One architect leads each project and stays responsible for it until handover.'),
more: tx('Koncepcję pokazujemy w trzech wariantach, z modelem bryły i analizą nasłonecznienia, żeby decyzje zapadały na podstawie tego, co widać, a nie tylko rysunków. Potem przygotowujemy projekt budowlany, składamy wniosek o pozwolenie i rysujemy projekt wykonawczy z detalami, z którym wykonawca może wycenić i postawić dom bez zgadywania.', 'We show the concept in three options, with a massing model and a daylight analysis, so decisions rest on what you can see, not only on drawings. Then we prepare the permit design, file the application and draw the construction set with details, so a contractor can price and build the house without guessing.'),
title: tx('Architektura domów', 'Residential architecture'),
},
{
@@ -52,6 +53,7 @@ const SERVICES = [
media: 'interior',
slug: { en: 'interior-design', pl: 'projektowanie-wnetrz' },
text: tx('Projektujemy wnętrza od układu ścian po klamki. Pracujemy na naturalnych materiałach i ponadczasowych formach, więc wnętrze nie zestarzeje się po dwóch sezonach.', 'We design interiors from the wall layout to the door handles. We work with natural materials and timeless forms, so the interior does not date after two seasons.'),
more: tx('Zaczynamy od inwentaryzacji i rozmowy o tym, jak korzystasz z każdego pomieszczenia. Potem rysujemy układ funkcjonalny, meble na wymiar i oświetlenie, a materiały wybieramy na próbkach w pracowni. Dostajesz wizualizacje każdego pomieszczenia, rysunki dla stolarza i listę zakupów z linkami, więc wykonawcy wiedzą dokładnie, co mają zrobić.', 'We start with a measured survey and a conversation about how you use every room. Then we draw the layout, built-in furniture and lighting, and choose materials from samples at the studio. You get renderings of every room, drawings for the joiner and a shopping list with links, so the contractors know exactly what to do.'),
title: tx('Projektowanie wnętrz', 'Interior design'),
},
{
@@ -60,6 +62,7 @@ const SERVICES = [
media: 'volumes',
slug: { en: 'site-supervision', pl: 'nadzor-autorski' },
text: tx('Nadzór autorski to nasza obecność na budowie: odpowiadamy na pytania wykonawców, sprawdzamy detale i dokumentujemy postęp. Ty dostajesz raport po każdej wizycie.', 'Site supervision means we are present on site: we answer the contractors’ questions, check the details and record the progress. You get a report after every visit.'),
more: tx('Przyjeżdżamy na budowę raz w tygodniu i na każdy ważny etap: fundamenty, więźbę, stolarkę i wykończenie. Sprawdzamy zgodność z projektem, rozwiązujemy problemy, zanim staną się kosztowne, i zatwierdzamy zmiany materiałów. Raport ze zdjęciami trafia do Ciebie tego samego dnia, więc wiesz, co się dzieje, nawet jeśli nie możesz przyjechać.', 'We visit the site once a week and at every key stage: foundations, roof structure, windows and finishes. We check the work against the design, solve problems before they get expensive and approve material changes. A report with photos reaches you the same day, so you know what is happening even when you cannot come.'),
title: tx('Nadzór autorski', 'Site supervision'),
},
]
@@ -133,10 +136,38 @@ const CASES = [
},
]
/**
* Every page's own meta description (≤ 155 characters, unique, both languages), keyed by its pl slug.
* Without one a page falls back to the site description, and Google ignores descriptions it sees on many pages.
*/
const META: Record<string, { en: string; pl: string }> = {
'architektura-domow': tx('Projekty domów jednorodzinnych: analiza działki, koncepcja w trzech wariantach, projekt budowlany i wykonawczy. Example Studio, Warszawa.', 'Family house design: site analysis, a concept in three options, permit and construction drawings. Example Studio, Warsaw.'),
blog: tx('Blog pracowni Example Studio: jak wybrać działkę, ile trwa projekt domu, z czego budować. Odpowiedzi na pytania klientów, bez żargonu.', 'The Example Studio blog: choosing a plot, how long a house design takes, what to build with. Answers to clients’ questions, no jargon.'),
bloki: tx('Strona testowa biblioteki bloków ipal-kit: każdy blok w każdym wariancie, także na odwróconym tle. Niewidoczna dla wyszukiwarek.', 'The ipal-kit block library test page: every block in every variant, also on the inverted background. Hidden from search engines.'),
kontakt: tx('Napisz do Example Studio: odpowiadamy w ciągu jednego dnia roboczego. Pierwsza rozmowa o domu, wnętrzu albo nadzorze jest bezpłatna.', 'Write to Example Studio: we reply within one working day. The first conversation about a house, an interior or supervision is free.'),
'nadzor-autorski': tx('Nadzór autorski: cotygodniowe wizyty na budowie, odbiory etapów i raport ze zdjęciami po każdej wizycie. Example Studio.', 'Site supervision: weekly site visits, stage inspections and a photo report after every visit. Example Studio.'),
'nie-znaleziono': tx('Nie znaleziono strony w serwisie Example Studio. Przejdź na stronę główną albo skorzystaj z menu.', 'Page not found on the Example Studio site. Go to the home page or use the menu.'),
'o-nas': tx('Example Studio to sześcioro architektów z Warszawy. Od 2014 roku projektujemy domy i wnętrza, prowadząc każdy projekt od rozmowy do odbioru.', 'Example Studio is six architects from Warsaw. Since 2014 we have designed houses and interiors, leading each project from the first talk to handover.'),
'polityka-cookies': tx('Polityka cookies Example Studio: jakich plików cookies używamy, w jakim celu i jak zmienić zgodę.', 'The Example Studio cookie policy: which cookies we use, why, and how to change your consent.'),
'polityka-prywatnosci': tx('Polityka prywatności Example Studio: kto przetwarza dane z formularzy, w jakim celu i jakie masz prawa.', 'The Example Studio privacy policy: who processes form data, for what purpose and what your rights are.'),
'projektowanie-wnetrz': tx('Projektowanie wnętrz mieszkań, domów i biur: układ, meble na wymiar, materiały z próbkami i wizualizacje każdego pomieszczenia.', 'Interior design for flats, houses and offices: layout, built-in furniture, materials from samples and renderings of every room.'),
realizacje: tx('Realizacje Example Studio: dom pod lasem, przebudowa kamienicy i kawiarnia z czytelnią — założenia, decyzje, materiały i czas realizacji.', 'Example Studio case studies: a house by the forest, a tenement conversion and a café with a reading room — brief, decisions, materials, timing.'),
regulamin: tx('Regulamin serwisu Example Studio — przykładowa treść strony referencyjnej ipal-kit.', 'Terms of service of the Example Studio site — sample text on the ipal-kit reference site.'),
start: tx('Example Studio — pracownia architektury i wnętrz z Warszawy. Projektujemy domy i wnętrza z naturalnych materiałów, które dobrze się starzeją.', 'Example Studio — an architecture and interior studio in Warsaw. We design houses and interiors in natural materials that age well.'),
uslugi: tx('Usługi Example Studio: projekty domów, projektowanie wnętrz i nadzór autorski. Zakres, proces i orientacyjne ceny.', 'Example Studio services: house design, interior design and site supervision. Scope, process and indicative prices.'),
wycena: tx('Poproś o wycenę projektu: trzy krótkie kroki, odpowiedź z wyceną i harmonogramem w ciągu trzech dni roboczych.', 'Ask for a project quote: three short steps, a reply with the price and schedule within three working days.'),
}
/** The page with its own meta description from META (by its pl slug). */
function withMeta<T extends { slug: unknown }>(page: T): T & { meta?: { description: { en: string; pl: string } } } {
const slug = typeof page.slug === 'string' ? page.slug : (page.slug as { pl?: string }).pl
const description = slug ? META[slug] : undefined
return description ? { ...page, meta: { description } } : page
}
export async function seedDemoGlobals(seed: Seeder, media: Record<string, string>) {
await seed.fillGlobal('company', company)
await seed.fillGlobal('site-settings', {
allowThemeToggle: true,
defaultShareImage: media.arches,
defaultTheme: 'system',
favicon: media['icon-example-studio'],
@@ -156,11 +187,11 @@ export async function seedDemoPages(seed: Seeder, media: Record<string, string>)
blocks,
form: { $form: 'Quote form' },
overrides: {
faq: { header: header(tx('Pytania o tę usługę', 'Questions about this service')), items: [{ answer: tx('Zwykle od dwóch do czterech miesięcy, zależnie od wielkości projektu.', 'Usually two to four months, depending on the size of the project.'), question: tx('Ile trwa projekt?', 'How long does a project take?') }, { answer: tx('Tak, pracujemy w całej Polsce; na budowę dojeżdżamy według harmonogramu.', 'Yes, we work across Poland and visit sites on a schedule.'), question: tx('Czy pracujecie poza Warszawą?', 'Do you work outside Warsaw?') }] },
faq: { header: header(tx('Pytania o tę usługę', 'Questions about this service')), items: [{ answer: tx('Zwykle od dwóch do czterech miesięcy, zależnie od wielkości projektu.', 'Usually two to four months, depending on the size of the project.'), question: tx('Ile trwa projekt?', 'How long does a project take?') }, { answer: tx('Tak, pracujemy w całej Polsce; na budowę dojeżdżamy według harmonogramu.', 'Yes, we work across Poland and visit sites on a schedule.'), question: tx('Czy pracujecie poza Warszawą?', 'Do you work outside Warsaw?') }, { answer: tx('Po pierwszej rozmowie przygotowujemy wycenę z zakresem i harmonogramem. Płacisz w ratach po każdym etapie.', 'After the first conversation we prepare a quote with the scope and the schedule. You pay in instalments after each stage.'), question: tx('Jak wygląda wycena?', 'How does the quote work?') }] },
featureGrid: { header: header(tx('Co dostajesz', 'What you get')), items: s.benefits.map((heading) => ({ heading })) },
gallery: { header: header(tx('Wybrane realizacje', 'Selected work')), items: ['facade', 'interior', 'courtyard'].map((m) => ({ media: media[m] })) },
hero: { header: header(s.title, s.intro, tx('Usługa', 'Service')), media: media[s.media] },
textMedia: { content: rich([s.text.pl], [s.text.en]), header: header(tx('Jak pracujemy', 'How we work')), media: media[['stairs', 'arches', 'pavilion'][i]] },
textMedia: { content: rich([s.text.pl, s.more.pl], [s.text.en, s.more.en]), header: header(tx('Jak pracujemy', 'How we work')), media: media[['stairs', 'arches', 'pavilion'][i]] },
},
slug: s.slug,
title: s.title,
@@ -169,13 +200,33 @@ export async function seedDemoPages(seed: Seeder, media: Record<string, string>)
const blogIndex = pageTemplates.blogIndex({
blocks,
layout: (b) => [b[0], { blockType: 'entryList', entryCollection: 'posts', limit: 9, mode: 'latest', variant: 'cards' }, ...b.slice(1)],
layout: (b) => [
b[0],
{
blockType: 'richText',
content: rich(
['Piszemy o tym, o co klienci pytają nas najczęściej: jak wybrać działkę, ile naprawdę trwa projekt, z czego budować i jak przygotować się do rozmowy z wykonawcą. Każdy wpis powstaje na podstawie naszych projektów i odpowiada na jedno konkretne pytanie, bez żargonu i bez reklam. Jeśli chcesz, żebyśmy napisali o czymś jeszcze, wyślij nam pytanie przez formularz kontaktowy.'],
['We write about what clients ask us most often: how to choose a plot, how long a design really takes, what to build with and how to prepare for the conversation with a contractor. Every post comes from our own projects and answers one specific question, without jargon and without ads. If you want us to write about something else, send us your question through the contact form.'],
),
variant: 'narrow',
},
{ blockType: 'entryList', entryCollection: 'posts', limit: 9, mode: 'latest', variant: 'cards' },
...b.slice(1),
],
overrides: { cta: contactCta, hero: { header: header(tx('Blog', 'Blog'), tx('O projektowaniu, materiałach i budowie — bez żargonu.', 'On design, materials and building — without the jargon.')), variant: 'page' } },
})
const caseStudiesIndex = {
layout: [
{ blockType: 'hero', header: header(tx('Realizacje', 'Case studies'), tx('Domy, wnętrza i przebudowy, które zaprojektowaliśmy.', 'Houses, interiors and conversions we designed.')), variant: 'page' },
{
blockType: 'richText',
content: rich(
['Każda realizacja zaczyna się od rozmowy o tym, jak klient chce żyć albo pracować, a kończy na odbiorze z nami na budowie. Poniżej pokazujemy wybrane projekty: dom jednorodzinny, przebudowę kamienicy i wnętrze kawiarni. Przy każdym opisujemy założenia, najważniejsze decyzje projektowe, materiały i to, ile trwała droga od koncepcji do klucza w drzwiach.', 'Wszystkie projekty prowadzimy w tym samym rytmie: rozmowa, koncepcja w wariantach, projekt i nadzór na budowie. Dzięki temu klient od początku wie, kiedy zapadają decyzje i ile kosztują, a my możemy pokazać efekt bez niespodzianek na końcu.'],
['Every project starts with a conversation about how the client wants to live or work, and ends with a handover where we are on site. Below are selected projects: a family house, a tenement conversion and a café interior. For each we describe the brief, the key design decisions, the materials and how long it took from the concept to the key in the door.', 'We run every project in the same rhythm: conversation, concept in options, design and supervision on site. That way the client knows from the start when decisions are made and what they cost, and we can show the result without surprises at the end.'],
),
variant: 'narrow',
},
{ blockType: 'entryList', entryCollection: 'caseStudies', limit: 9, mode: 'latest', variant: 'cards' },
{ blockType: 'cta', ...contactCta },
],
@@ -186,13 +237,31 @@ export async function seedDemoPages(seed: Seeder, media: Record<string, string>)
const quote = {
layout: [
{ blockType: 'hero', header: header(tx('Wycena projektu', 'Project quote'), tx('Trzy krótkie kroki. Odpowiemy z wyceną w ciągu trzech dni roboczych.', 'Three short steps. We reply with a quote within three working days.')), variant: 'page' },
{
blockType: 'richText',
content: rich(
['Wycena obejmuje zakres prac, podział na etapy, harmonogram i warunki płatności. Im więcej wiemy na starcie, tym dokładniejsza będzie: podaj lokalizację, przybliżoną powierzchnię, rodzaj budynku albo wnętrza i planowany termin rozpoczęcia. Jeśli masz rzuty, zdjęcia, mapę do celów projektowych albo wypis z planu miejscowego, wspomnij o nich w formularzu — poprosimy o pliki w odpowiedzi. Wycena jest bezpłatna i do niczego nie zobowiązuje.'],
['The quote covers the scope of work, the stages, the schedule and the payment terms. The more we know at the start, the more precise it is: tell us the location, the rough floor area, the type of building or interior and when you plan to start. If you have floor plans, photos, a survey map or an extract from the local plan, mention them in the form — we will ask for the files in our reply. The quote is free and commits you to nothing.'],
),
variant: 'narrow',
},
{ blockType: 'contact', form: { $form: 'Quote form' }, variant: 'formOnly' },
{
blockType: 'steps',
header: header(tx('Co dzieje się dalej', 'What happens next')),
items: [
{ heading: tx('Czytamy zgłoszenie', 'We read your request'), text: tx('Architekt prowadzący sprawdza zakres, metraż i termin, a w razie pytań dzwoni lub pisze.', 'The lead architect checks the scope, floor area and timing, and calls or writes if anything is unclear.') },
{ heading: tx('Wysyłamy wycenę', 'We send the quote'), text: tx('W ciągu trzech dni roboczych dostajesz wycenę z podziałem na etapy i harmonogram prac.', 'Within three working days you get a quote split into stages, with a schedule of the work.') },
{ heading: tx('Umawiamy spotkanie', 'We meet'), text: tx('Omawiamy wycenę w pracowni albo online i odpowiadamy na pytania, zanim cokolwiek podpiszesz.', 'We go through the quote at the studio or online and answer your questions before you sign anything.') },
],
variant: 'numbered',
},
],
slug: { en: 'quote', pl: 'wycena' },
title: tx('Wycena', 'Quote'),
}
await seed.upsertBySlug('pages', [
const pages: { slug: unknown }[] = [
pageTemplates.home({
blocks,
overrides: {
@@ -294,8 +363,8 @@ export async function seedDemoPages(seed: Seeder, media: Record<string, string>)
blocks,
form: { $form: 'Contact form' },
overrides: {
contact: { content: rich(['Odpowiadamy w ciągu jednego dnia roboczego. Wolisz porozmawiać? Zadzwoń w godzinach pracy pracowni.'], ['We reply within one working day. Prefer to talk? Call us during studio hours.']), form: { $form: 'Contact form' }, header: header(tx('Napisz do nas', 'Write to us')) },
faq: { header: header(tx('Zanim napiszesz', 'Before you write')), items: [{ answer: tx('Adres działki albo mieszkania, przybliżony metraż i termin.', 'The address of the plot or flat, the rough floor area and the timing.'), question: tx('Co warto podać w wiadomości?', 'What should I include in the message?') }, { answer: tx('Tak, w pracowni albo online — jak wolisz.', 'Yes, at the studio or online — whichever you prefer.'), question: tx('Czy można się spotkać?', 'Can we meet?') }] },
contact: { content: rich(['Odpowiadamy w ciągu jednego dnia roboczego. Wolisz porozmawiać? Zadzwoń w godzinach pracy pracowni.', 'Napisz, czego dotyczy projekt: dom, wnętrze czy nadzór, gdzie się znajduje i kiedy chcesz zacząć. Jeśli masz rzuty, zdjęcia albo plan miejscowy, wspomnij o nich — poprosimy o pliki w odpowiedzi. Pierwsza rozmowa jest bezpłatna.'], ['We reply within one working day. Prefer to talk? Call us during studio hours.', 'Tell us what the project is about: a house, an interior or supervision, where it is and when you want to start. If you have floor plans, photos or the local plan, mention them — we will ask for the files in our reply. The first conversation is free.']), form: { $form: 'Contact form' }, header: header(tx('Napisz do nas', 'Write to us')) },
faq: { header: header(tx('Zanim napiszesz', 'Before you write')), items: [{ answer: tx('Adres działki albo mieszkania, przybliżony metraż i termin.', 'The address of the plot or flat, the rough floor area and the timing.'), question: tx('Co warto podać w wiadomości?', 'What should I include in the message?') }, { answer: tx('Tak, w pracowni albo online — jak wolisz.', 'Yes, at the studio or online — whichever you prefer.'), question: tx('Czy można się spotkać?', 'Can we meet?') }, { answer: tx('Tak. Dane z formularza służą tylko do odpowiedzi na wiadomość; szczegóły są w polityce prywatności.', 'Yes. We use the form data only to answer your message; the details are in the privacy policy.'), question: tx('Czy moje dane są bezpieczne?', 'Is my data safe?') }] },
hero: { header: header(tx('Kontakt', 'Contact'), tx('Odpowiadamy w ciągu jednego dnia roboczego.', 'We reply within one working day.')), variant: 'page' },
},
}),
@@ -337,7 +406,8 @@ export async function seedDemoPages(seed: Seeder, media: Record<string, string>)
}),
pageTemplates.notFound({ blocks }),
showcasePage(media),
])
]
await seed.upsertBySlug('pages', pages.map(withMeta))
await seed.upsertBySlug('posts', POSTS.map((p) => ({
...pageTemplates.post({
@@ -347,6 +417,7 @@ export async function seedDemoPages(seed: Seeder, media: Record<string, string>)
}),
aiSummary: p.excerpt,
excerpt: p.excerpt,
meta: { description: p.excerpt },
media: media[p.media],
publishedAt: p.publishedAt,
slug: p.slug,
@@ -356,6 +427,7 @@ export async function seedDemoPages(seed: Seeder, media: Record<string, string>)
await seed.upsertBySlug('caseStudies', CASES.map((c) => ({
aiSummary: c.excerpt,
excerpt: c.excerpt,
meta: { description: c.excerpt },
layout: [
{ blockType: 'hero', header: header(c.title, c.excerpt, tx('Realizacja', 'Case study')), media: media[c.media], variant: 'background' },
{ blockType: 'textMedia', content: rich([c.text.pl], [c.text.en]), header: header(tx('Projekt', 'The project')), media: media[c.gallery[1]], variant: 'mediaRight' },
+6 -5
View File
@@ -96,20 +96,21 @@ export function post(options?: TemplateOptions): TemplatePage {
}
const LEGAL = {
privacyPolicy: { slug: tx('privacy-policy', 'polityka-prywatnosci'), title: tx('Privacy policy', 'Polityka prywatności') },
termsOfService: { slug: tx('terms', 'regulamin'), title: tx('Terms of service', 'Regulamin') },
privacyPolicy: { slug: tx('privacy-policy', 'polityka-prywatnosci'), text: tx('privacy policy text from the client or their lawyer', 'treść polityki prywatności od klienta lub prawnika'), title: tx('Privacy policy', 'Polityka prywatności') },
termsOfService: { slug: tx('terms', 'regulamin'), text: tx('terms of service text from the client or their lawyer', 'treść regulaminu od klienta lub prawnika'), title: tx('Terms of service', 'Regulamin') },
}
/** A legal page (privacy policy, terms): header and text with a table of contents, `noindex`. Structure only — the wording comes from the client. */
export function legal(role: keyof typeof LEGAL, options?: TemplateOptions): TemplatePage {
const { slug, title } = LEGAL[role]
const { slug, text, title } = LEGAL[role]
return noindex(buildTemplate(role, { slug, title }, [
pageHero(title),
{
blockType: 'richText',
content: sections({
en: [['[TO FILL: section heading]', '[TO FILL: text provided by the client or their lawyer]']],
pl: [['[TO FILL: nagłówek sekcji]', '[TO FILL: treść od klienta lub prawnika]']],
// the placeholder names its page, so an unfilled page still gets its own meta description
en: [['[TO FILL: section heading]', `[TO FILL: ${text.en}]`]],
pl: [['[TO FILL: nagłówek sekcji]', `[TO FILL: ${text.pl}]`]],
}),
tableOfContents: { label: tx('Contents', 'Spis treści'), show: true },
variant: 'narrow',
+19 -1
View File
@@ -33,12 +33,15 @@ const SUBHEADING_KEYS = new Set(['subheading', 'subtitle'])
const QUESTION_KEYS = new Set(['question'])
const TEXT_KEYS = new Set([
'answer',
'bio',
'body',
'caption',
'content',
'description',
'excerpt',
'intro',
'label',
'quote',
'summary',
'text',
])
@@ -72,12 +75,27 @@ function imageMarkdown(v: unknown): string {
return url ? `![${alt}](${url})` : ''
}
/**
* The section header group of buildSectionHeaderField (`header: { eyebrow, heading, intro }`) — every library block
* has one. Heading first, then the intro; the eyebrow is a label, not content.
*/
function headerMarkdown(value: unknown): string {
if (!value || typeof value !== 'object' || Array.isArray(value)) {return ''}
const h = value as Record<string, unknown>
const heading = typeof h.heading === 'string' ? h.heading.trim() : ''
const intro = typeof h.intro === 'string' ? h.intro.trim() : ''
return [heading && `## ${heading}`, intro].filter(Boolean).join('\n\n')
}
/** Extract readable Markdown from one block's known content fields. */
function extractBlock(block: Block, depth: number): string {
const lines: string[] = []
// The section header leads the block, wherever the key sits in the stored object
const header = headerMarkdown(block.header)
if (header) {lines.push(header)}
for (const [key, value] of Object.entries(block)) {
if (value == null) {continue}
if (value == null || key === 'header') {continue}
if (HEADING_KEYS.has(key) && typeof value === 'string' && value.trim()) {
lines.push(`## ${value.trim()}`)
+55
View File
@@ -0,0 +1,55 @@
/**
* blocksToMarkdown reads the library blocks' section header (eyebrow, heading, intro). Without it a page whose text
* is only in its hero (an archive, a quote page, a 404) got no auto-filled meta description and fell back to the
* site description, and /md pages and llms-full.txt missed every section heading and intro.
*/
import { describe, expect, test } from 'vitest'
import { blocksToMarkdown } from '../src/modules/content/blocksToMarkdown.js'
import { buildAutoFillMetaHook } from '../src/modules/seo/autoFillMeta.js'
const hero = { blockType: 'hero', header: { eyebrow: 'Studio', heading: 'Case studies', intro: 'Houses, interiors and conversions we designed.' }, variant: 'page' }
describe('blocksToMarkdown — section header', () => {
test('heading becomes ## and the intro follows; the eyebrow is left out', () => {
expect(blocksToMarkdown([hero])).toBe('## Case studies\n\nHouses, interiors and conversions we designed.')
})
test('the header leads the block even when other keys come first in the stored object', () => {
// eslint-disable-next-line perfectionist/sort-objects -- the stored key order (question → answer, header last) is what this test checks
const faq = { blockType: 'faq', items: [{ question: 'How long?', answer: 'Two to four months.' }], header: { heading: 'Questions' } }
expect(blocksToMarkdown([faq])).toBe('## Questions\n\n**How long?**\n\nTwo to four months.')
})
test('team bios and gallery captions are text', () => {
const team = { blockType: 'team', items: [{ bio: 'Founder, designs houses.', heading: 'Anna' }] }
const gallery = { blockType: 'gallery', items: [{ caption: 'The courtyard at dusk.' }] }
expect(blocksToMarkdown([team, gallery])).toContain('Founder, designs houses.')
expect(blocksToMarkdown([gallery])).toBe('The courtyard at dusk.')
})
test('testimonial quotes and intros are text', () => {
const t = { blockType: 'testimonials', items: [{ heading: 'Marta K.', quote: 'Morning sun in the kitchen.' }] }
expect(blocksToMarkdown([t])).toContain('Morning sun in the kitchen.')
})
test('an empty or missing header adds nothing', () => {
expect(blocksToMarkdown([{ blockType: 'cta', header: {} }, { blockType: 'cta', header: null }])).toBe('')
})
})
describe('autoFillMeta — a page with only a hero gets its own description', () => {
test('meta.description comes from the hero intro, not the site description', () => {
const hook = buildAutoFillMetaHook()
const data = hook({ context: {}, data: { layout: [hero, { blockType: 'entryList', entryCollection: 'posts' }], title: 'Case studies' } } as never) as { meta: { description: string } }
expect(data.meta.description).toBe('Houses, interiors and conversions we designed.')
})
})
describe('page templates — unfilled pages still differ', () => {
test('the privacy policy and terms placeholders name their page (no shared meta description)', async () => {
const { pageTemplates } = await import('../src/modules/block-library/templates/index.js')
const text = (page: { layout: Record<string, unknown>[] }) => JSON.stringify(page.layout.find((b) => b.blockType === 'richText'))
expect(text(pageTemplates.legal('privacyPolicy'))).not.toBe(text(pageTemplates.legal('termsOfService')))
})
})