Page settings fields

The list of a page's settings and their defaults, with read and write helpers.

On this page

@pagehub/sdk/page-settings/fields is the list of a page's settings, with each one's default. PageHub's page settings form and its settings API both read this list, so a field is added in one place.

TypeScript
import {
  PAGE_SETTINGS_FIELDS,
  PAGE_SETTINGS_KEYS,
  pageSettingsDefaults,
  readSettingsProps,
  writeSettingsProps,
} from "@pagehub/sdk/page-settings/fields";

The fields

Each entry is { key, nodePath?, defaultValue }. key is the flat name a form and the API use; nodePath is where the value is stored, when that differs (the SEO fields live under seo.*).

GroupKeys
BasicpageSlug, pathPattern
SEO (stored under seo.*)pageTitle, pageDescription, pageKeywords, pageAuthor, ogTitle, ogDescription, ogImage, ogType (default website), twitterCard (default summary_large_image), twitterSite, twitterCreator, canonicalUrl, jsonLd, schema
AdvancedheadCode, footerCode, bodyClass, hideHeader, hideFooter, hideChrome, pagePassword, themeOverrides
AccessconditionGroups, pageConditionFailAction, pageConditionRedirectUrl, pageConditionFallbackPageId

The page name and the home and 404 flags aren't in the list: they're handled on their own.

Helpers

  • PAGE_SETTINGS_KEYS: just the keys, for an allowlist.
  • pageSettingsDefaults(): an object with every key set to its default.
  • readSettingsProps(source): reads every field from stored props (following nodePath), filling in defaults.
  • writeSettingsProps(target, values): writes a set of values back to their storage paths, and removes a flat copy of a field that moved under seo.*.

Source: packages/sdk/src/page-settings/fields.ts.