Skip to content
Twilight React Playground
ثيم رائدaren

Route modules

./routes./routes/home./routes/cart./routes/product./routes/product-listing./routes/blog./routes/brands./routes/account./routes/account/orders./routes/loyalty./routes/page./routes/testimonials./routes/thank-you./routes/seo-redirects

The built-in pages: each is a loader, a head function and a component you can reuse or fork.

Each storefront page (home, product, cart, blog…) is a route module: a loader that fetches the page data, a head that sets the title and meta tags, and a Component that draws it. Your theme gets all of them for free and can replace any part.

Entries

Route modules

Every built-in page is an object with a loader that fetches its data, a head that sets its tags, and a Component that draws it.

route-moduleBeginnerlive demo
Forking a built-in page

Take over one built-in page: point its path at your own route file, reuse the module's loader and head, and swap or wrap its Component.

route-moduleBeginnerlive demo
Home

The store's home page: loads the blocks the merchant arranged and draws each one with the component registered for its path.

route-moduleBeginnerlive demo
registerHomeComponents, DefaultHomeComponents, registerHomeComponentConfig

The home block registry, re-exported beside the Home module: register which component draws each kind of block before any page renders.

functionBeginner
Product

The product page: loads one product by id with its breadcrumbs, and gives it full search-engine tags, including schema.org Product data.

route-moduleBeginnerlive demo
ProductListing

One module behind every product grid: categories, search, tags, brand pages, and the latest, best-selling and offers lists.

route-moduleBeginnerlive demo
Cart

The cart page, whose loader returns only a title because the visitor's cart id exists in the browser, not on the server.

route-moduleBeginnerlive demo
PageSingle

A merchant's content page, such as About us or Terms: loads it by id and shows its HTML and comments.

route-moduleBeginnerlive demo
Blog

The blog home page with featured slides, categories and latest articles, rendering empty lists rather than an error when the blog fails to load.

route-moduleBeginnerlive demo
BlogSingle

One blog article with its related articles, likes and comments, using the article's own SEO title, description and image when set.

route-moduleBeginnerlive demo
BlogAuthorRoute, BlogCategoryRoute, BlogTagRoute

Blog article lists filtered by one author, one category or one tag, each with the category sidebar and more articles as the reader scrolls.

route-moduleBeginnerlive demo
Brands

The A to Z brands directory: every brand logo, grouped by first letter, each linking to that brand's product list.

route-moduleBeginnerlive demo
Testimonials

The store reviews page, whose loader only sets a title while Salla's comments web component loads and sorts the reviews in the browser.

route-moduleBeginner
Loyalty

The loyalty program page, listing ways to earn points and prizes to redeem, or a 404 page when the store runs no program.

route-moduleBeginner
ThankYou

The order confirmation page Salla sends shoppers to after paying, which renders even when the order details cannot be loaded.

route-moduleBeginner
Profile, Settings

The signed-in customer's profile and account settings pages, built from Salla's ready-made web components and refused to guests.

route-moduleBeginner
Orders

The signed-in customer's order history, optionally filtered by status, as a table that loads more orders on request.

route-moduleBeginner
OrderSingle

One order's details for its customer: items, amounts, shipping and status, with reorder, cancel, receipt and rating actions.

route-moduleBeginner
Wishlist

The signed-in customer's saved products, starting from the ?page= in the address and loading further pages as they scroll.

route-moduleBeginner
Wallet

The signed-in customer's wallet balance and transaction history, starting from the ?page= in the address and loading more as they scroll.

route-moduleBeginner
Notifications

The signed-in customer's notifications, such as order status changes, as one list with read and unread styling.

route-moduleBeginnerlive demo
slugBrandRedirectLoader, pendingOrdersRedirectLoader

Loaders that render nothing and redirect: old /<slug>/brand-<id> links to the brand's product list, and /pending-orders to the orders list.

functionAdvanced
head (product listing)

ProductListing's head function on its own: title, canonical and share tags for any product list, from its category or tag when there is one.

functionAdvanced
Product listing types

The pieces of ProductListLoaderData: page metadata, the source and its entity, the sort query and the tag shape, plus an unused category props type.

typeAdvanced
Blog data types

The shapes of blog articles, authors, categories and tags that the blog loaders return, for typing your own blog components.

typeAdvanced
Order, OrderItem, OrderListItem

The order shapes the account and thank-you pages use: a full order, one line of it, and the lighter row the orders list returns.

typeAdvanced
@salla.sa/twilight-theme-engine/routes

A lightweight index of shared route types, locale helpers and one redirect loader; route modules themselves live only on the granular subpaths.

typeAdvanced

Also exported here

These exports have no page of their own yet. Their signatures, straight from the engine's type declarations, are in the complete list.

ExportKindImport path
useAppliedFiltershook@salla.sa/twilight-theme-engine/routes/product-listing
parseFiltersFromSearchfunction@salla.sa/twilight-theme-engine/routes/product-listing
AppliedFiltersStatustype@salla.sa/twilight-theme-engine/routes/product-listing