Generated Config From TOML
Files: src/config/config.toml, scripts/toml-watcher.mjs · Skill level: Beginner
Veltro converts its editable TOML configuration to JSON.
- Source:
src/config/config.toml - Generated output:
.astro/config.generated.json - Generator:
scripts/toml-watcher.mjs
Components and utilities import the generated file:
import config from ".astro/config.generated.json";Relevant Scripts
In the Astro edition, package.json has:
"dev": "node scripts/dev.mjs","toml:watch": "node scripts/toml-watcher.mjs","build": "npm run toml:watch && astro build && npm run remove-draft-from-sitemap"npm run dev generates the settings file from config.toml, watches it for changes, and starts the site. Production builds regenerate it before Astro runs.
The Sanity edition has the same dev and build lines. The Tina edition runs them through its own script, scripts/tina/run.mjs, which does the same and also starts the editor:
"dev": "node scripts/tina/run.mjs dev","build": "node scripts/tina/run.mjs build"Always edit src/config/config.toml. Treat .astro/config.generated.json as generated output. In the Tina edition, Site settings at /admin/ saves to config.toml. In the Sanity edition, a value in Site settings in the Studio wins over the same value in config.toml.
What’s Inconfig.toml
| Table | What it holds |
|---|---|
[site], [site.favicon] | Title, description, tagline, baseUrl, logos, trailingSlash, and the favicon source. See Site Identity & Logo |
[seo] | author, keywords, and robots |
[seo.robotsTxt] | enable, disallow, aiSearch, and aiTraining, for /robots.txt |
[seo.ai] | llmsTxt and markdownPages, for the AI-readable files. See AI Links & llms Files |
[seo.sitemap] | enable and exclude |
[settings] | Content folder names, pagination, stickyHeader, contactFormAction, contactFormProvider, footerDescription, and companyDesk |
[settings.smoothScroll] | The smooth scroll settings. See Smooth Scroll |
[settings.pageJump] | enable and duration, for the keys that jump to the top or bottom of a page |
[settings.cursor] | The circle that follows the mouse |
[settings.pageActions] | enable, footer, and providers, for the Ask AI links |
[settings.themeCredit] | enable, text = "...", and url = "...", for the theme credit |
[settings.copyright] | enable and text |
[settings.subscription] | Nothing reads this on Veltro. See Subscription |
[settings.multilingual] | enable, defaultLanguage, disableLanguages, and showDefaultLangInUrl |
[settings.contactInfo] | phone, email, address, and mapLink |
[settings.headerOffcanvas] | enable and logo, for the mobile menu. See Header |
[settings.navigationButton] | enable, label, and url, for the header button |
[settings.markup.tableOfContents] | enable, expanded, startLevel, endLevel, and ordered |
[opengraph] | image, ogLocale, ogType, twitter, and twitterCard |
[head] | content, for analytics tags and other code in the page head |