Edit this topic

Content renderer

: request

: renderer

: content

: /modules/core/content/services/content-renderer.js

: https://github.com/DecentCMS/DecentCMS/blob/master/modules/core/content/services/content-renderer.js


The ContentRenderer is responsible for the content item rendering lifecycle.


Adds a shape or a content item to the list of shapes for the request.

Param Type Description
[options.id] string The id of an item to fetch and add as a shape.
[options.shape] object A shape to add to the list of shapes to render.
[options.displayType] string The display type to use when rendering the shape.

contentRenderer.render(context, pageBuilt)

Builds the rendered page from the list of shapes that was prepared so far. This method defines the rendering lifecycle, by emitting events and service calls:

  • 'placement-strategy'.placeShapes({shape, shapes, renderStream}, done)
  • 'shape-handler'.handle({shape, shapes, renderStream}, done)
  • decent.core.register-meta
  • decent.core.register-style
  • decent.core.register-script
  • 'rendering-strategy'.render({shape, shapes, renderStream}, done)
Param Type Description
[context.scope] object The scope, which is normally the current request.
[context.request] IncomingMessage The request.
[context.response] ServerResponse The response.
pageBuilt function The function to call when the page has been rendered.


Calls for meta tag registering.


Calls for style sheet registering.


Calls for script registering.