- 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]>
138 lines
6.8 KiB
TypeScript
138 lines
6.8 KiB
TypeScript
import type { Seeder } from '@intecion/ipal-kit/seed'
|
|
|
|
import { libraryBlockSlugs } from '@intecion/ipal-kit/blocks'
|
|
import { pageTemplates, systemPageRefs } from '@intecion/ipal-kit/templates'
|
|
|
|
import { blockOptions } from '@/blocks/configs'
|
|
|
|
import { pageLink, tx } from './lib'
|
|
|
|
/**
|
|
* BASE layer — what every new site needs, kept by the project starter: the standard pages from the library
|
|
* templates ([TO FILL] where only the client can write), system page roles, navigation, cookie banner texts,
|
|
* the cookie list and the image viewer labels. Create-only: pages and fields the demo layer (or an editor)
|
|
* already filled are skipped.
|
|
*/
|
|
const blocks = libraryBlockSlugs(blockOptions)
|
|
|
|
export async function seedBaseGlobals(seed: Seeder) {
|
|
// the inbox and the name come from the starter's answers (AGENTS.md → Project decisions)
|
|
await seed.fillGlobal('company', { email: '[email protected]', name: 'Example Studio' })
|
|
await seed.fillGlobal('site-settings', {
|
|
// @starter:if themeToggle
|
|
// toggle on is the field's default — seeding the default would rewrite it on every run
|
|
// @starter:else
|
|
//: allowThemeToggle: false,
|
|
// @starter:endif
|
|
// @starter:if defaultLight
|
|
//: defaultTheme: 'light',
|
|
// @starter:endif
|
|
// @starter:if defaultDark
|
|
//: defaultTheme: 'dark',
|
|
// @starter:endif
|
|
// @starter:if defaultSystem
|
|
defaultTheme: 'system',
|
|
// @starter:endif
|
|
siteName: 'Example Studio',
|
|
themeToggleLabel: tx('Tryb ciemny', 'Dark mode'),
|
|
})
|
|
}
|
|
|
|
export async function seedBasePages(seed: Seeder) {
|
|
await seed.upsertBySlug('pages', [
|
|
pageTemplates.home({ blocks }),
|
|
pageTemplates.about({ blocks }),
|
|
pageTemplates.services({ blocks }),
|
|
pageTemplates.contact({ blocks, form: { $form: 'Contact form' } }),
|
|
// The archive page lists its entries with an entry list block (the editor decides where)
|
|
// @starter:if posts
|
|
pageTemplates.blogIndex({ blocks, layout: (b) => [b[0], { blockType: 'entryList', entryCollection: 'posts', limit: 9, mode: 'latest', variant: 'cards' }, ...b.slice(1)] }),
|
|
// @starter:endif
|
|
pageTemplates.legal('privacyPolicy', { blocks }),
|
|
pageTemplates.legal('termsOfService', { blocks }),
|
|
pageTemplates.cookiePolicy({ blocks }),
|
|
pageTemplates.notFound({ blocks }),
|
|
])
|
|
}
|
|
|
|
export async function seedBaseNavigation(seed: Seeder) {
|
|
const link = (label: { en: string; pl: string }, slug: string) => ({ link: { label, page: { $page: slug }, type: 'internal' } })
|
|
await seed.fillGlobal('site-settings', {
|
|
...systemPageRefs({ cookiePolicy: 'polityka-cookies', homepage: 'start', notFound: 'nie-znaleziono', privacyPolicy: 'polityka-prywatnosci', termsOfService: 'regulamin' }),
|
|
// @starter:if posts
|
|
postsArchive: { $page: 'blog' },
|
|
// @starter:endif
|
|
})
|
|
await seed.fillGlobal('header', {
|
|
links: [pageLink(tx('Kontakt', 'Contact'), 'kontakt')],
|
|
menuLabel: tx('Menu', 'Menu'),
|
|
navItems: [
|
|
link(tx('O nas', 'About'), 'o-nas'),
|
|
link(tx('Usługi', 'Services'), 'uslugi'),
|
|
// @starter:if posts
|
|
link(tx('Blog', 'Blog'), 'blog'),
|
|
// @starter:endif
|
|
link(tx('Kontakt', 'Contact'), 'kontakt'),
|
|
],
|
|
})
|
|
await seed.fillGlobal('footer', {
|
|
columns: [
|
|
{
|
|
heading: tx('Strona', 'Site'),
|
|
items: [
|
|
link(tx('O nas', 'About'), 'o-nas'),
|
|
link(tx('Usługi', 'Services'), 'uslugi'),
|
|
// @starter:if posts
|
|
link(tx('Blog', 'Blog'), 'blog'),
|
|
// @starter:endif
|
|
],
|
|
},
|
|
],
|
|
})
|
|
}
|
|
|
|
/** Cookie banner and image viewer texts in both languages; the cookie list holds what the site itself sets. */
|
|
export async function seedBaseTexts(seed: Seeder) {
|
|
await seed.fillGlobal('cookie-settings', {
|
|
alwaysActiveLabel: tx('Zawsze aktywne', 'Always active'),
|
|
buttons: {
|
|
acceptAll: tx('Akceptuj wszystkie', 'Accept all'),
|
|
back: tx('Wstecz', 'Back'),
|
|
close: tx('Zamknij', 'Close'),
|
|
reject: tx('Odrzuć', 'Reject'),
|
|
savePreferences: tx('Zapisz wybór', 'Save my choice'),
|
|
settings: tx('Ustawienia', 'Settings'),
|
|
},
|
|
categories: [
|
|
{ description: tx('Potrzebne, żeby strona działała: zapamiętują zgodę i język.', 'Needed for the site to work: they remember your consent and language.'), key: 'necessary', title: tx('Niezbędne', 'Necessary') },
|
|
{ description: tx('Zapamiętują ustawienia, np. motyw jasny lub ciemny.', 'Remember settings such as the light or dark theme.'), key: 'functional', title: tx('Funkcjonalne', 'Functional') },
|
|
{ description: tx('Pomagają zrozumieć, jak odwiedzający korzystają ze strony.', 'Help us understand how visitors use the site.'), key: 'analytics', title: tx('Analityczne', 'Analytics') },
|
|
{ description: tx('Służą do mierzenia skuteczności reklam.', 'Used to measure how well ads work.'), key: 'marketing', title: tx('Marketingowe', 'Marketing') },
|
|
],
|
|
cookies: [
|
|
{ category: 'necessary', duration: tx('12 miesięcy', '12 months'), name: 'cookie-consent', provider: tx('ta strona', 'this site'), purpose: tx('Zapamiętuje Twój wybór w sprawie cookies.', 'Remembers your cookie choice.'), storage: 'cookie' },
|
|
{ category: 'necessary', duration: tx('12 miesięcy', '12 months'), name: 'NEXT_LOCALE', provider: tx('ta strona', 'this site'), purpose: tx('Zapamiętuje wybrany język.', 'Remembers the chosen language.'), storage: 'cookie' },
|
|
{ category: 'functional', duration: tx('bez limitu', 'no expiry'), name: 'theme', provider: tx('ta strona', 'this site'), purpose: tx('Zapamiętuje motyw jasny lub ciemny.', 'Remembers the light or dark theme.'), storage: 'localStorage' },
|
|
],
|
|
detailLabels: { cookies: tx('Pliki cookies', 'Cookies'), duration: tx('Czas', 'Duration'), provider: tx('Dostawca', 'Provider'), purpose: tx('Cel', 'Purpose'), storage: tx('Rodzaj', 'Type') },
|
|
message: tx(
|
|
'Używamy niezbędnych plików cookies, żeby strona działała. Za Twoją zgodą użyjemy też cookies analitycznych.',
|
|
'We use necessary cookies to make the site work. With your consent we also use analytics cookies.',
|
|
),
|
|
privacyLinkLabel: tx('Polityka prywatności', 'Privacy policy'),
|
|
settingsDescription: tx('Wybierz, na które kategorie się zgadzasz. Zmienisz to w każdej chwili.', 'Choose which categories you agree to. You can change it at any time.'),
|
|
settingsTitle: tx('Ustawienia cookies', 'Cookie settings'),
|
|
title: tx('Szanujemy Twoją prywatność', 'We respect your privacy'),
|
|
})
|
|
await seed.fillGlobal('notifications', {
|
|
lightbox: {
|
|
close: tx('Zamknij', 'Close'),
|
|
counter: tx('{current} / {total}', '{current} / {total}'),
|
|
dialog: tx('Podgląd zdjęcia', 'Image viewer'),
|
|
next: tx('Następne zdjęcie', 'Next image'),
|
|
open: tx('Powiększ zdjęcie', 'Enlarge image'),
|
|
previous: tx('Poprzednie zdjęcie', 'Previous image'),
|
|
},
|
|
})
|
|
}
|