The Wise Operator, Scott Krukowski
Back to Dictionary

Static Routing

A system where each page on your website corresponds to an actual file in your project, so the URL structure mirrors the folder structure.

Static routing (also called file-based routing) means each URL on your website maps directly to a file in your project folder. If you create a file called about.astro in your pages directory, you get a page at /about. Frameworks like Astro and Next.js use this approach, and it produces individual HTML pages that search engines can easily crawl and CDNs can cache for fast delivery.

The Simple Version

With static routing, the page at yoursite.com/blog is generated from a file at src/pages/blog.astro in your project. The page at yoursite.com/glossary/git comes from a file or template that handles glossary terms. The URL you see in the browser maps directly to a file in the codebase.

This is the opposite of a Single Page Application, where a single file handles all routes and JavaScript figures out what to show.

Why It Matters

Static routing is predictable. You can look at a project’s file structure and immediately know what URLs exist. There’s no routing logic to debug, no JavaScript required to navigate between pages. Search engines also prefer this approach because every page exists as real HTML that can be crawled and indexed independently.

How It’s Used on This Site

Astro uses file-based static routing. The file src/pages/blog/index.astro becomes /blog. The file src/pages/glossary/[...slug].astro generates a page for every glossary term. The URL structure of the site is a direct reflection of the file structure in the project.


Browse the Full Dictionary