Progressive Web Application

Progressive Web Application Feature (pwa)

Settings that control the site’s progressive web application feature.

JSON Schema

Definition
{
  "$id": "https://platen.io/modules/platen/config/site/features/pwa/schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "Settings that control the site's progressive web application feature.\n\nhttps://platen.io/modules/platen/config/site/features/pwa/",
  "properties": {
    "enabled": {
      "default": true,
      "description": "Choose whether the site is generated as a PWA.\n\nhttps://platen.io/modules/platen/config/site/features/pwa/#enabled",
      "title": "Enable PWA",
      "type": "boolean"
    },
    "partials": {
      "description": "Define a map of partials for Platen to inject as needed.\n\nhttps://platen.io/modules/platen/config/site/features/pwa/#partials",
      "properties": {
        "header": {
          "default": "platen/features/pwa/header",
          "description": "Injects a partial into the HTML header.\n\nhttps://platen.io/modules/platen/config/site/features/pwa/#header",
          "title": "Header Partial",
          "type": "string"
        }
      },
      "title": "Feature Partials",
      "type": "object"
    }
  },
  "title": "Progressive Web Application Feature",
  "type": "object"
}

Enable PWA (enabled)

Choose whether the site is generated as a progressive web application. The default is true.

Feature Partials (partials)

Define a map of partials for Platen to inject as needed. These partials are only injected when enabled is set to true.

Header Partial (header)

If specified, this partial is processed in the HTML header with the current page’s context. The default value is platen/features/pwa/header. You can overwrite this value, replacing it with another partial entirely, or you can add the same file to your own theme or site, effectively replacing it.

The default partial creates the service worker (sw.js) and manifest (manifest.json) files required to turn the static website into a progressive web application. The service worker is created from the scripts/features/pwa/sw-register.js resource and processed as a template. The manifest is created from the scripts/features/pwa/manifest.json resource and also processed as a template. Both are then inserted into the HTML header.

Edit this page