Use when working with Remix routing in this repository as a static site generator (SSG). Covers file-based routing, dynamic segments, layout groups, and best practices.
This skill covers using Remix as a static site generator (SSG) in this repository, including file-based routing conventions, dynamic segments, layout groups, and best practices for creating routes.
This repository uses Remix with Vite to generate a static site. Routes are pre-rendered at build time using the ssg-cli.ts script, which crawls routes and generates static HTML files.
Remix uses a flat file structure in app/routes/ where the file path maps directly to URL routes:
app/routes/_landing._index/route.tsx → /app/routes/b._index/route.tsx → /bapp/routes/b.$slug/route.tsx → /b/:slugapp/routes/h.$slug/route.tsx → /h/:slugLayout Groups (prefixed with _): Group related routes without affecting the URL
_landing groups landing page routes_index denotes the index route for a segmentDynamic Segments (prefixed with $): Create parameterized routes
$slug captures a URL parameter named slug/b/$slug for blog posts and /h/$slug for help pagesFile Organization: Each route has its own directory with:
route.tsx - The main route componentlayout.tsx, error.tsx, or other Remix filesA typical route component exports a default React component and optional loaders/actions:
import type { LoaderFunctionArgs } from '@remix-run/node';
export async function loader(args: LoaderFunctionArgs) {
// Load data at build time or request time
return { data: '...' };
}
export default function RouteComponent() {
// Render the route
return <div>Content</div>;
}
For SSG, routes must be crawlable by the build system:
$slug) need getStaticPaths or crawler hintsstyling-react-with-tailwind skill)public/ directoryapp/routes/[segment]/app/routes/[segment]/route.tsx/{segment}$ prefix: app/routes/section.$id/useParams() or loader args_ prefix for layout groups (e.g., _landing)app/routes/**/route.tsxssg-cli.ts - Generates static siteapp/root.tsx - Global layout and stylingvite.config.ts - Vite + Remix build configurationpublic/ directorystyling-react-with-tailwind - CSS styling approach