Introducing a new way to review your PRs.

Read the announcement

frappe / builder

Craft beautiful websites effortlessly with an intuitive visual builder and publish them instantly

View on GitHub

20 documents · Updated Nov 23, 2026

docs / website-rendering-and-publishing

Website rendering and publishing

Builder turns authored page content into website responses for visitors, editors, and preview tools. It joins page state with components, scripts, theme data, metadata, and public assets so the same visual content can be reviewed, published, and shown on a live route.

Page response lifecycle

The page response lifecycle maps a website path to the Builder page that visitors should receive. Route state and access rules decide whether Builder serves the page or lets normal Frappe route handling continue.

flowchart LR
    A[Website request] --> B[Route resolution]
    B --> C{Eligible Builder page}
    C -->|No| D[Frappe route handling]
    C -->|Yes| E[Builder rendering]
    E --> F[Page content and assets]
    F --> G[Website HTML response]

Live and staging pages can match a route. Staging content remains out of search results and the sitemap. A page can require a signed-in user. Dynamic routes can pass path values into page data and block bindings. The renderer also sets a canonical URL for the response.

References: builder/…/builder_page.py• L68-104 builder/…/builder_page.py• L239-286 builder/…/builder_page.json• L68-80

Builder editor route

The Builder editor route provides the authoring shell and its initial site context. An app path that identifies an allowed demo can instead show a published page snapshot without the working editor session.

The normal editor route remains session-aware and receives the context needed by the editor. The demo route exits before session and CSRF details are added, so it stays inert even for a signed-in visitor. It does not expose draft content or turn the published page into another authenticated editor entry point.

References: builder/…/_builder.py• L14-20 builder/editor_demo.py• L41-81 builder/hooks.py• L198-210

Content state

Builder separates working content from visitor content. Draft blocks hold edits for the next version. Live blocks hold the version that live and staging responses render.

Publishing records a publish snapshot, moves the draft into the live content, clears the draft, and refreshes the page image. Staging makes the working content available for review without making it a search-visible live page.

Page stateWebsite responseSearch visibility
LiveServes live contentAvailable when indexable
StagingServes live content for reviewExcluded from search and the sitemap
OfflineDoes not serve the pageNot discoverable
flowchart LR
    A[Editor changes] --> B[Draft content]
    B --> C[Publish or stage]
    C --> D[Publish snapshot]
    C --> E[Live content]
    E --> F[Website response]
    B --> G[Preview response]

The editor reads the draft when one exists. This lets authors review the next version without changing the visitor response. Preview mode disables response caching so the editor receives current work.

References: builder/…/builder_page.py• L382-451 builder/…/builder_page.py• L421-435 builder/…/builder_page.py• L520-553 builder/…/builder_page.json• L75-87 builder/…/test_builder_page.py• L181-267

Block and component rendering

The block renderer turns the page tree into page markup and styles. A page can include reusable Builder components. Each component supplies a shared block structure while the page supplies its use of that structure and its local values.

Data scripts and passed properties provide values for text, attributes, visibility, and repeated content. Page data runs before the response is built, so it can also affect metadata or redirect behavior. This connects authored visual structure with request-specific data.

References: builder/…/builder_page.py• L544-593 builder/…/builder_page.py• L801-913 builder/…/builder_page.py• L1164-1269 builder/…/builder_page.py• L1413-1467 builder/…/test_builder_page.py• L334-445 builder/…/test_builder_page.py• L529-609

Website shell and page assets

The website shell wraps generated page content in a complete document. It provides language, title, favicon, canonical links, search metadata, styles, fonts, theme values, and optional head or body content.

Page-wide JavaScript and CSS come from Builder settings and page-linked client scripts. Block scripts stay with their blocks. The response also exposes the page data used by browser code through window.page_data, which keeps client behavior aligned with server-rendered content.

Public assets keep their site URLs in website responses. When a standard page is exported into an app, its referenced media, component assets, fonts, tokens, and client scripts move with the page dependencies.

References: builder/…/webpage.html• L1-69 builder/…/webpage_scripts.html• L1-28 builder/…/builder_page.py• L627-659 builder/…/builder_page.py• L1322-1367 builder/export_import_standard_page.py• L22-84

Theme and font behavior

Builder Tokens provide shared values for color, size, and type. Normal responses link to the token stylesheet. Preview responses place token CSS in the HTML because the image process cannot fetch the dynamic token route.

The page can follow the visitor's light or dark preference or use a selected scheme. Preview can select a scheme so the editor and rendered preview agree. Images with light and dark sources follow that scheme. Rendering also loads the font families and weights used by the page.

References: builder/…/tokens.py• L1-7 builder/…/builder_token.py• L84-120 builder/…/builder_page.py• L520-543 builder/…/builder_page.py• L717-723 builder/…/webpage.html• L25-53 builder/…/test_builder_page.py• L1359-1407

Preview responses

The Builder preview is an authenticated iframe that requests server-rendered HTML for a selected page. It sends route values and a color scheme. Preview mode then renders draft content without publishing it.

The response uses inline theme tokens and the same page assets and scripts as a website response. It does not record visitor view activity or show the editor link that can appear for a normal signed-in website visitor.

sequenceDiagram
    participant E as Builder editor
    participant P as Preview API
    participant R as Page renderer
    participant I as Preview iframe
    E->>P: Request draft page and route values
    P->>R: Render in preview mode
    R->>R: Select draft content and inline theme CSS
    R-->>P: HTML response
    P-->>I: Return HTML
    P->>P: Queue thumbnail generation

References: frontend/…/PagePreview.vue• L222-235 builder/api.py• L37-59 builder/…/builder_page.py• L696-715 builder/…/builder_page.py• L520-588 builder/…/webpage_scripts.html• L11-20 builder/…/test_builder_page.py• L117-138

Editor demo snapshots

The editor demo is a read-only view of a published page. It contains enough page content, component data, tokens, fonts, templates, and public scripts to show the page in a browser. It does not contain drafts, page data scripts, or other site data.

Site configuration must allow the demo. The page must be published and public. The snapshot is cached against page changes, while response limits keep the demo separate from the signed-in editor context.

References: builder/editor_demo.py• L1-6 builder/editor_demo.py• L16-39 builder/editor_demo.py• L45-114 builder/editor_demo.py• L117-152 builder/…/_builder.py• L14-20

Preview imagery

Builder stores a WebP page thumbnail for page lists and template views. It renders the thumbnail from preview-mode HTML, so a draft can receive an image before publication.

The image process uses local headless Chromium when available and can use a configured preview service as a fallback. Standard pages store images in site files. Template pages store them with template public assets. AI visual review uses a taller capture and splits long pages into tiles, while dashboard thumbnails use the normal capture path.

References: builder/…/builder_page.py• L437-444 builder/…/builder_page.py• L685-694 builder/html_preview_image.py• L6-38 builder/utils.py• L501-511 builder/…/preview.py• L20-39 builder/…/preview.py• L63-93

Publish-facing behavior

Published responses add visitor-facing behavior that preview suppresses. View and click tracking run only for non-preview responses. A signed-in desktop visitor can receive a link back to the Builder editor.

Indexing controls decide whether the response emits noindex, nofollow. Staging uses the same search exclusion. Page title and description provide default metadata, while page data can provide custom values. A home page uses the site root as its canonical URL.

The 404 route has special behavior. A published Builder page at that route becomes the editable site error page. Without one, Frappe serves the fallback 404 page. The fallback also changes its home link when it runs inside the editor preview frame.

References: builder/…/webpage.html• L10-24 builder/…/webpage_scripts.html• L11-20 builder/…/builder_page.py• L520-605 builder/…/builder_page.json• L75-80 builder/…/404.py• L6-21 builder/…/404.html• L1-43 builder/…/test_builder_page.py• L181-240

Sitemap discovery

The sitemap lists URLs that search engines should discover. It combines eligible static pages, public document routes, and the Builder page that visitors receive for each route. Redirecting routes are removed.

Builder pages enter the sitemap only when published and indexable. Protected pages, non-indexable pages, dynamic routes, and pages with another fixed canonical URL stay out. The output includes each final URL and an optional last-change date.

References: builder/…/sitemap.py• L16-29 builder/…/sitemap.py• L50-71 builder/…/sitemap.py• L74-116 builder/…/sitemap.xml• L1-11

Legacy Web Page entry points

The Frappe Web Page screens remain available for existing Web Page records. When the user can create Builder pages, their new-page action opens Builder instead, while the existing Web Page list and records remain editable in the legacy screen.

This creates a product boundary rather than a rendering path: new authoring starts in Builder, but existing Web Page content keeps its prior management surface. Users without Builder page create access continue to use the standard Web Page action.

References: builder/…/web_page.js• L1-16 builder/…/web_page_list.js• L1-29

Change checklist

When these files or sections are changed, remember to consider these:

  • Route state changes must keep live-page precedence, staging search exclusion, route cache clearing, and sitemap behavior aligned.
  • Changes to the live-versus-draft contract must preserve the publish snapshot boundary and preview selection of draft content.
  • Changes to block bindings or component data must keep server data aligned with page data scripts and component properties.
  • Changes to token delivery must update both the normal token route and the preview inline CSS path.
  • Changes to client script links or public asset paths must preserve both website URLs and standard-page export paths.
  • Changes to preview HTML must be checked against iframe previews and queued WebP thumbnail generation.
  • Changes to the Builder editor entry route must preserve the separation between the session-aware editor and the published demo snapshot.
  • Changes to demo snapshot fields or its allow-list must not add drafts, server data scripts, or authenticated page data to the browser payload.
  • Changes to published route eligibility must keep sitemap selection aligned with live-page precedence, canonical URLs, robots rules, access settings, and redirects.
  • Changes to legacy Web Page actions must preserve the choice between Builder authoring and existing Web Page editing based on create access.

Important failure modes

TriggerConsequenceGuard
A page is not live or stagingRoute matching does not select it for a website requestPublish or stage the page before relying on its route
Live and staging pages share a routeThe wrong page can answer the requestKeep live-page selection ahead of staging selection
A staging page is treated as liveSearch engines can expose review contentKeep staging tied to search exclusion and sitemap exclusion
A token route is used during screenshot capturePreview imagery can miss theme valuesInline token CSS in preview responses
A component reference cannot be resolvedThe page can lose its intended structure or dataKeep referenced components and pinned versions available
A page data script failsThe response can stop before complete HTML returnsTreat page data scripts as part of the response contract
A preview renderer is unavailableThumbnail or visual review generation failsUse the local renderer or configured fallback service
A demo path targets an unpublished or protected pageThe request is rejected instead of exposing private contentAllow only published pages with public access
A protected, redirected, dynamic, or non-canonical route enters the sitemapSearch engines can discover a URL visitors should not useApply publish, index, canonical, access, and redirect checks before listing
New Web Page action ignores create accessUsers can be sent to an editor they cannot useKeep the Builder-versus-legacy action check in both Web Page surfaces

Key files

FileWhy to read it
builder/…/builder_page.pyMain route, live/staging, publish, preview, page-data, and block-render flow
builder/…/builder_page.jsonPage states and fields that control serving, metadata, access, scripts, and assets
builder/…/webpage.htmlWebsite document shell and theme asset placement
builder/…/webpage_scripts.htmlRuntime scripts, analytics hooks, editor link, and preview behavior
builder/…/builder_component.pyComponent data and page synchronization model
builder/…/builder_token.pyShared token CSS and cache behavior
builder/…/builder_client_script.pyPage client script publication as public JavaScript or CSS
builder/api.pyPreview HTTP entry point and queued thumbnail refresh
builder/html_preview_image.pyHTML-to-WebP rendering boundary
builder/export_import_standard_page.pyStandard-page export of page dependencies and public assets
frontend/…/PagePreview.vueEditor preview iframe and route parameter flow
builder/…/404.pySpecial handling for a served Builder not-found page
builder/…/404.htmlFallback not-found response and preview-frame back-link behavior
builder/…/_builder.pyBuilder editor shell context and published demo branch
builder/editor_demo.pyRead-only page snapshot, demo access rules, payload scope, and security headers
builder/…/sitemap.pySitemap route sources, Builder page eligibility, route precedence, and redirect filtering
builder/…/web_page.jsLegacy Web Page form entry behavior for new Builder pages
builder/…/web_page_list.jsLegacy Web Page list notice and create-action routing