.astro components. Fimo adds Studio preview, editing, and the site-wide SEO defaults from Studio’s SEO settings without installing React or taking control of Astro routing or per-page metadata.
Start a new Astro project with the opt-in first-party shell:
- npm
- Bun
- pnpm
- Yarn
--framework is omitted.
The starter is barebones: one disposable welcome homepage, no schemas, and a single home route. Replace the homepage and declare the content models your site needs.
It also ships a 404 page, /robots.txt and /sitemap.xml. Both files use the site’s address and are built by the endpoints in src/pages. The sitemap lists the pages declared in .fimo/config.json#routes; add the pages it cannot list to src/pages/sitemap.xml.ts. A site with no address yet has an empty sitemap, and its robots.txt names none.
The Astro starter sets devToolbar: { enabled: false } in astro.config.mjs so the toolbar cannot cover content during Studio editing. Set enabled: true to restore it. Adding Fimo to an existing project leaves its toolbar setting unchanged; you can disable it in that project’s config if it interferes with editing.
Configure the runtime
fimo-astro at the same version as fimo, then add the Fimo integration beside the adapters and integrations the project already uses:
- npm
- Bun
- pnpm
- Yarn
fimo-astro owns Fimo hosting for output: 'server' projects; content and components stay in fimo. Fimo loads its preview script only inside a Fimo preview, reports the current location to Studio, and uses full-page Astro navigation when Studio changes pages. You do not need to add a provider, preview URL, or script tag.
The integration also recovers the hosted preview if Vite re-optimizes a client-island dependency during its first load. You do not need to refresh Studio manually.
A static Astro site hosted elsewhere can import fimo from fimo/astro/config instead, which wires the preview connector and branch environment without a hosting adapter.
Generate content clients
Createsrc/schemas/<Uid>.json, then run:
<Uid>.ts module plus its public types. Fimo does not generate React hooks, .client.ts modules, or a client content registry.
Read and render content
Text, RichText, Image, StaticImage, Video, Date, Boolean, and Json. Pass tracked values directly so Fimo preserves their data-fimo-source metadata.
Rendering
The starter keeps Astro’s static output, so every page is built when the site publishes and visits never query the site’s database. Content edits reach the live site with the next publish either way. For a route that needs per-visitor data, setoutput: 'server', mark that route export const prerender = false
and every other page export const prerender = true. See
database compute.
SEO defaults
Resolve the current route, apply page values, then convert to native attributes. New projects have this insrc/layouts/Base.astro. Existing apps should extend
their current head component, preserving unrelated metadata.
buildSiteSchemas returns the site’s Organization and WebSite JSON-LD once the
SEO settings have a site name and URL, and nothing before that.
For a content page, resolve after loading the entry and pass the final values
to the layout: const seo = resolveSeoForPath(Astro.url.pathname, config, { article }),
then <Base lang={locale} seo={seo}>. Route templates can read
{{article.title}}. Apply app-owned overrides before conversion so the title,
Open Graph and Twitter tags agree.
The example canonical policy fits a root-hosted site. Preserve the app’s own
production domain, base path and trailing-slash policy. Omitting the converter’s
canonicalUrl omits canonical and og:url; seo.url alone is only a site base.
A resolved seo.url is the seo.url in .fimo/config.json when it is set,
otherwise FIMO_SITE_URL.
Imported config changes need sync and rebuild/redeploy. Content freshness
follows the route’s rendering and caching policy.
Routes and locales
The starter configures Astro’s native i18n router from.fimo/config.json: the default locale stays unprefixed and other locales use their Astro prefix. Use Astro.currentLocale for generated content reads, getLabels(), and document language. Existing sites can keep another Astro locale strategy; Fimo does not impose a router or provider.
Client-island content hooks are not part of the Astro surface yet. Preserve existing islands and do not add React just to read Fimo content.
Content & CMS
Declare schemas and use generated collection or Single clients.