A Web_Portal__c is a container. A Page__c is a single page that belongs to a portal through the Page__c.Web_Portal__c lookup. One portal has many pages. Because the link is a lookup, not master detail, a page can exist without a portal, and deleting a portal orphans its pages rather than deleting them.
The portal record also points back at two specific pages:
Home_Page__c is the landing page rendered when the portal is opened by name.Page_404__c is rendered for unknown routes.Set both lookups on the Web Portal record after creating the pages.
Each page has a Guest_User_Accessible__c checkbox. When checked, unauthenticated visitors can view and interact with the page. When unchecked, the runtime treats the page as protected: if the visitor is not logged in, it clears the page and fires the login flow instead. See Login and registration.
The runtime is a single page app that routes by URL hash used as a name slug, not by path. A portal URL looks like:
https://<site>/b3p__Portal#<PortalOrPageName>?recordId=<id>&sessionKey=<token>
Resolution:
getPageNameFromAnchor), falling back to a ?page= query parameter.b3p.Portal action bootstrap with that name and the session key. One trip returns the session user, the custom blocks and the pages of the portal. In place navigations reuse that page list and call getPages only when the requested page is not already available.recordId and sessionKey parameters are read from the post hash query string. recordId becomes the context record for merge tags. sessionKey seeds the login session (used by magic links).So #MyPortal renders that portal home page, and #SomePage (or ?page=SomePage) renders a specific page.
Navigation between pages uses hash links. A link with href="#PageName" triggers an in place render when SPA mode is on (Portals_are_SPA__c), otherwise a full reload. Hovering a page link pre warms its template into cache. The browser back button re-renders the previous page.
For portals with passkeys enabled, add a link to a signed-in page with its destination set to @passkeys. It opens the current Contact's active passkeys for the configured origin and lets them remove a credential. Adding another passkey requires a fresh email-code login. See Passkey login and Login and registration for other action links.
A page does not store its HTML in a field. When you save in the builder, two Salesforce Files are written against the Page record:
Template.b3p is the editable 3B Portals project model, loaded by the builder.Template_html.b3p is the compiled html, css, and js, loaded by the runtime.Both are gzip plus base64 compressed. The runtime reads only Template_html.b3p. See Publishing pages.
A page marked Sub_Template__c becomes a reusable fragment other pages can embed. In the builder, drop the Sub Template block (Interactions category): the sub-template manager opens and lists every page flagged as a sub template. Choose the page and the insertion mode, then Insert. Cancelling removes the block again.
<div is-dynamic="true" sub-page-id="<pageId>" sub-page-name="<name>"> and shows a labelled card on the canvas. At runtime the router fetches and injects the sub template HTML before merge and conditional display run, so shared headers, footers, or navigation stay in one place and update everywhere.The block can be reconfigured later: select it and use the cog in its toolbar (or the Choose template button in the traits panel) to switch the page or the mode; the content is replaced accordingly. The manager also links to the selected sub template so it can be opened in another builder tab. Like every block, sub templates support the Hide If condition and the Visibility trait.
Dynamic sub templates are the recommended pattern for shared chrome such as navigation bars. See Merge tags and dynamic data for the runtime injection order.