Expand description
Sites — one tenant, several hostnames, each with its own root page.
The framework’s registry answers “which tenant owns this hostname”
(rustango::tenancy::OrgHost). This answers the next question: once
we are inside the tenant, which part of the page tree does that
hostname serve?
§How a request finds its page
Without a site mapping the resolver anchors on the conventional
empty-slug root, so anything else is reachable only under its own
path — /site-b/about. Mapping a hostname to that page makes it
answer at siteb.com/about instead.
The mapped page need not be a root. The prefix is only ever its
url_path, so /campaigns/spring binds to a hostname exactly as a
root does.
The translation is done at the edges rather than in the stored data:
- on the way in, the request path is prefixed with the site root’s
url_pathbefore lookup; - on the way out, that prefix is stripped from generated links.
url_path therefore stays tenant-absolute and tree_ops is untouched.
The alternative — storing site-relative paths — means moving a page
between sites rewrites every descendant’s URL, and two roots would be
free to collide on /about with nothing to tell them apart.
Structs§
- Site
- A hostname bound to a root page within this tenant.
Functions§
- all
- Every site mapping, newest hostname order, for the admin.
- hosts_
for_ root - The hostnames rooted at
root_page_id. - prefix_
for_ host - The URL prefix
hostnameserves under. - root_
for_ host - The page
hostnameis mapped to serve, orNonewhen it serves the default root (no mapping, or one whose page has been deleted). - to_
lookup_ path - Prefix a public request path with the site root’s path.
- to_
public_ path - Strip the site root’s prefix from a tenant-absolute
url_path.