@rolino/astro
v0.15.0
Published
Astro integration for published Rolino articles, with static and server rendering
Maintainers
Readme
@rolino/astro
Add a Rolino blog to Astro 7.3.3 or later in the Astro 7 series. The integration
uses static builds by default and follows output: 'server' automatically.
It adds native HTML pages, safe Markdown rendering, redirects, and a sitemap.
No browser API key or client-side article rendering is required.
This integration is a preview and requires the matching Astro preview support
in your Rolino deployment. For local testing before an npm release, use the
workspace package or an npm pack tarball.
Setup
- In Rolino, open Blog → Settings → Available integrations → Astro and create the connection. Save the one-time environment values.
- In your Astro project, run
npx astro add @rolino/astro@nextfor the npm preview. - Set
ROLINO_URL,ROLINO_BLOG_SITE_ID, andROLINO_BLOG_DELIVERY_TOKENin your local.envand the host's private build/server environment. Never use Astro'sPUBLIC_prefix for these values. - Deploy the site and select Test connection in Rolino. Static sites then ask for a hosting deploy hook. Server-rendered sites need no build hook.
Connection testing reads the deployed site. It does not publish an article or
trigger a build. Existing /blog routes are protected: migrate them deliberately
or select an unused path. Import and connection do not grant publication approval.
// astro.config.mjs
import { defineConfig } from 'astro/config';
import rolino from '@rolino/astro';
export default defineConfig({
site: 'https://example.com',
integrations: [rolino()],
});The default routes are /blog, /blog/[...slug], /blog/sitemap.xml, and
/blog/rolino-status.json. The status file contains public article and revision
identifiers only. It lets Rolino verify which content reached the website.
Existing sites and layouts
rolino({
path: '/articles', // Must match the Blog base path saved in Rolino.
layout: './src/layouts/BlogLayout.astro',
mode: 'auto', // Optional: 'static' or 'server' for mixed-rendering sites.
})A custom layout receives title, description, canonical, language,
revision, and articleId. Render its default slot and add the title,
description and canonical link to your existing document head. The supplied
layout is a minimal accessible starting point with light and dark support.
Keep your existing navigation and design through a custom layout.
Use @rolino/astro/client for custom routes. Keep its calls on the server or at
build time, preserve the revision observation markers, and do not expose the
delivery token. Generated Markdown is sanitized before it is inserted as HTML;
embedded scripts and executable HTML attributes are removed.
Static sites
Each approved change triggers the host's HTTPS deploy hook with an empty POST. Standard hooks that need no separate header or request body are supported. Store the hook only in Rolino's Astro setup, where it is encrypted. Do not put it in the Astro client bundle, a public status file, or source control.
Rolino saves a durable request marker before calling the hook. An uncertain response never starts another build automatically. It checks the manifest and the actual article page until the exact revision is visible. A removal requires manifest absence plus a 404 or 410 response. Checks run through the shared worker for up to 30 attempts, normally one minute apart.
If the build failed, fix it and rebuild through your host. Then retry the saved delivery in Rolino to check the result. A retry checks the original operation; it does not send another build request. Host-specific authenticated CI workflows need their own supported bridge; they cannot use the empty POST hook directly.
Static slug changes generate Astro redirects to the current slug. Some static hosts serve those as HTML redirects. Configure host-level permanent redirects if your deployment requires an HTTP 301 response.
Server-rendered sites
Use the host's Astro adapter and output: 'server', or set mode: 'server' for
the blog alone. The supplied routes read published content per request and send
Cache-Control: no-store. No revalidation endpoint or signing secret is needed
for this uncached path. Your CDN must respect that policy. Site-specific caches
must have their own invalidation policy before they are enabled.
An API outage is an error, not an empty blog or an unpublished article. New articles and updates require no deployment. The routes return HTTP 301 for old slugs and HTTP 404 for unavailable articles.
Development checks
From the Rolino repository:
npm test --workspace @rolino/astro
node scripts/verify-astro-integration.mjs
node --env-file=.env scripts/verify-astro-database.mjsThe database check requires an isolated TEST_DATABASE_URL. It applies migrations
only to that test database. Never point it at a customer database.
