Rift Logo RiftJS

5/10/2025

Routing Shouldn’t Feel Like Magic: Build URLs Like a Developer

#routing #control #permalink

Routing Shouldn’t Feel Like Magic: Build URLs Like a Developer

Modern site generators love the illusion of simplicity.

You drop a file into pages/blog/[slug].js and the framework smiles: “We’ve handled routing for you.” Until you want to localize it. Or paginate it. Or generate routes from dynamic data.

Then you're in abstraction hell — juggling folders, filenames, and undocumented behavior.

Rift doesn’t play that game.


🧭 Real Routing with Real Data

In Rift, you define routes using two functions:

  • params(ctx) – tells Rift what data you want to render
  • permalink(ctx) – tells Rift exactly what URL to use for each page

That’s it. No guessing. No magic interpolation. No pretending that file structure is routing logic.


💥 File-Based Routing Fails at Scale

It works great for a five-page site. But try building a multilingual, paginated, tag-filtered blog with clean URLs using just filenames and folders. You’ll end up with:

  • Overnested folders
  • Conditional logic inside layout files
  • Hidden behaviors based on file naming

It’s brittle, unreadable, and difficult to scale.


✨ With Rift, URLs Are Just Strings

Want this?

/en/blog/javascript-is-awesome/

You write:

return `/${ctx.locale}/blog/${ctx.params.slug}/`

Simple. Obvious. Flexible.


🔁 Dynamic Pages? Easy.

If your data comes from an API, a DB, or a flat file — no problem.

In your controller, fetch it. Loop through it. Use ctx.param() to declare pages. Rift doesn’t care how you build the data — it just renders what you tell it to.

No restrictions. No "but only if it's in a folder."


🧠 Be the Router

You’re a developer. You don’t need a framework guessing what you meant. Rift gives you the tools to define your site’s structure like an engineer — not a magician.


⚡ Get Started

npm create rift@latest

Within 30 seconds, you’ll be writing actual route logic — not naming files to hope they behave the way you want.

Build Your Own Blog with Rift

Rift is a zero-guesswork static site generator built for developers. Try it today:

npm create rift@latest