Documentation

Dynamic Route Parameters

Interface Builder - Dynamic Route Content

A dynamic route uses part of its URL as a parameter, so one route can show many different records. A blog is the classic example: instead of building a route for every post, you build one /blog/:slug route and Qik loads whichever post is in the URL.

Say you want this section of your website:

  • /blog: a list of every post.
  • /blog/article:spring-workshop-recap: one post.
  • /blog/article:annual-conference-2026: another post, and so on.

Creating a route for every post would quickly become unmanageable. Dynamic route parameters solve this.

Creating a dynamic route

Create a route as normal (Routes → New Route). In its URL Path, use a colon followed by a name for each part of the URL that should change. For the example above, you'd create two routes:

  • /blog: a static route that lists the posts.
  • /blog/:slug: a dynamic route, where slug is whatever follows /blog/ in the URL.

The second route matches /blog/article:spring-workshop-recap, /blog/article:annual-conference-2026 and so on. The value is available in your code at $sdk.app.route.params.slug.

Automatic record loading

When a parameter's value identifies a record, Qik loads that record for you and adds it to the current route's items under the parameter's name, for example $sdk.app.route.items.slug. Qik loads a record when the value is either:

  • a record's ID (the 24-character code, such as 64dab19b6110b10e0bf0ff18), or
  • a record's absolute slug: its type and slug joined by a colon, such as article:spring-workshop-recap.

Any other value, such as a plain spring-workshop-recap, is not looked up. It's passed through as text, so items.slug holds the string itself. If you want Qik to load the record, link to it by its absolute slug or ID.

Records load with the application's permissions (or the visitor's, once they sign in). If the application can't see the record, nothing is loaded and the error is reported on $sdk.app.route.errors. If the record doesn't exist, Qik returns a "not found" response and shows your /404 route, if you have one.

Tip: for a public website, use the absolute slug (meta.abs) rather than the ID in your links. Readable URLs are better for search engines and for people.

Parameters for plain values

Sometimes you want a value from the URL that isn't a record at all, and you never want Qik to try to load it. Prefix the parameter with a double colon :: to make it a static value. For example, with the path /welcome/::name, visiting /welcome/sandy gives $sdk.app.route.params.name = "sandy", and Qik never looks for a record called "sandy". Use :: whenever the value could look like an ID or slug but isn't.

Previewing a dynamic route

When you select a dynamic route in the builder, an address bar appears above the preview. Type a value (an ID or absolute slug) into each parameter to preview the route with a real record. See The Preview Window.

Sitemaps for dynamic routes

Search engines can't guess which records exist. In the route's Settings, choose a smart list under Sitemap Records. The sitemap will then list one URL per record, filled in with each record's absolute slug. See Settings Sidebar.

FAQs

Why is items.slug just a string instead of my record?
The record exists but doesn't load on my site. Why?