Static Rendering
View as MarkdownStatic rendering is the default for Neutron routes. It is intended for pages whose output can be known at build time.
Build process
For each static route, neutron-ts build:
- Loads the matching layouts and page.
- Runs their loaders, if present.
- Renders the component tree to HTML.
- Writes the HTML and links it to the built stylesheet assets.
Dynamic routes are generated once for every parameter set returned by
getStaticPaths.
Client JavaScript
A plain static page does not receive Neutron's client router or page-shell hydration. Static pages can still contain authored scripts, native browser features such as view transitions, and independently hydrated islands.
This distinction matters: static describes when the page HTML is produced,
not a blanket prohibition on JavaScript.
Build-time data
Static loaders run during the build:
import { useLoaderData } from "@neutron-build/core";
export async function loader() {
return { posts: await listPublishedPosts() };
}
export default function Posts() {
const { posts } = useLoaderData<typeof loader>();
return <PostList posts={posts} />;
}
Rebuild to publish changes in that data. If the response must vary by user or request, use server-rendered app mode.