Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Page

The current page to render.

Hierarchy

  • Page

Index

Methods

getComponent

  • getComponent<T>(): T
  • getComponent<T>(...componentNames: string[]): T | undefined
  • Gets a root component in the page.

    Type parameters

    Returns T

    The root component.

  • Gets a component in the page (e.g. getComponent('main', 'right')).

    Type parameters

    Parameters

    • Rest ...componentNames: string[]

      The names of the component and its parents.

    Returns T | undefined

    The component, or undefined if no such component exists.

getContent

  • Gets a content item used on the page.

    Parameters

    • reference: Reference | string

      The reference to the content. It can be an object containing an RFC-6901 JSON Pointer.

    Returns Content | undefined

getMeta

  • getMeta(meta: MetaCollectionModel): Meta[]
  • Generates a meta-data from the provided meta-data model.

    Parameters

    • meta: MetaCollectionModel

      the meta-collection as returned by the page-model-api

    Returns Meta[]

getTitle

  • getTitle(): string | undefined
  • Returns string | undefined

    The title of the page, or undefined if not configured.

getUrl

  • getUrl(link?: Link): string
  • getUrl(path: string): string
  • Generates a URL for a link object.

    • If the link object type is internal or external, then it will prepend spaBaseUrl. In case when the link starts with the same path as in cmsBaseUrl, this part will be removed. For example, for link /site/_cmsinternal/spa/about with configuration options cmsBaseUrl = "http://localhost:8080/site/_cmsinternal/spa" and spaBaseUrl = "http://example.com" it will generate http://example.com/about.
    • If it is a resource link, then it will prepend the origin part from the cmsBaseUrl option. For example, for link /site/_cmsinternal/binaries/image1.jpg with configuration option cmsBaseUrl = "//localhost:8080/site/spa", it will generate //localhost/site/_cmsinternal/binaries/image1.jpg.
    • If the link parameter is omitted, then the link to the current page will be returned.
    • In other cases, the link will be returned as-is.

    Parameters

    • Optional link: Link

      The link object to generate URL.

    Returns string

  • Generates an SPA URL for the path.

    • If it is a relative path, then it will prepend spaBaseUrl.
    • If it is an absolute path, then the behavior will be similar to internal and external link generation.

    Parameters

    • path: string

      The path to generate URL.

    Returns string

isPreview

  • isPreview(): boolean
  • Returns boolean

    Whether the page is in the preview mode.

rewriteLinks

  • rewriteLinks(content: string, type?: SupportedType): string
  • Rewrite links to pages and resources in the HTML content. This method looks up for a tags with data-type and href attributes and img tags with src attribute. Links will be updated according to the configuration used to initialize the page.

    Parameters

    • content: string

      The HTML content to rewrite links.

    • Optional type: SupportedType

      The content type.

    Returns string

sync

  • sync(): void
  • Synchronizes the CMS integration state.

    Returns void

toJSON

  • toJSON(): PageModel
  • Returns PageModel

    A plain JavaScript object of the page model.