The pagebuilder is invoked to render content into the final HTML page

To use a pageBuilder, first set up a webdesign and its assetpack in your moduledefinition.yml

webDesigns:
  example_site:
    title: My Example Site
    siteProfile: webdesigns/example_site/example_site.siteprl.yml

assetPacks:
  example_site:
    entryPoint: webdesigns/example_site/example_site.ts
    supportedLanguages: [nl,en]

The example_site.siteprl.yml should be set up to refer to your assetpack and pagebuilder through an 'apply: all' rule:

apply:
  - to: all
    webDesign:
      assetPack: webhare_demo:example_site
      pageBuilder: render/rendersite.ts#buildExampleSitePage

A pagebuilder receives a PageBuildRequest containing the request context and the rendered page 'body', and renders this into a WebResponse using the 'render' call on the request

In its simplest form:

import { litty } from "@webhare/litty";
import type { PageBuildRequest, WebResponse } from "@webhare/router";

export async function buildExampleSitePage(req: PageBuildRequest): Promise<WebResponse> {
  return req.render({
    head: litty`<meta name="baidu-site-verification" content="bEAglE" />`,
    body: litty`<main>${req.content}</main>`
  });
}