---
title: Render reference
project: CMS
version: 1.0
section: development
language: en
license: MIT
url: https://totaljs.es/docs/cms/1-0/development/render-api/
updated: 2026-11-20T06:51:42.966Z
---

# Render reference

> The properties of opt and the next function of exports.render.

`exports.render(opt, next)` receives the instance and the request in `opt`, and gives back the content with `next`:

```js
exports.render = function(opt, next) {
	next('<b>' + opt.config.name.encode() + '</b>');
};
```

The entries of type **property** are properties of `opt`.

## API

### opt.config

Type: `property`

The configuration of the instance.

Returns: `Object`

The values saved by the settings form. An instance saved before you added a key to `exports.config` does not have that key.

### opt.html

Type: `property`

The inner HTML of the instance, as saved in the page.

Returns: `String`

It still holds the `CMS_` classes of the editor.

### opt.body

Type: `property`

The whole instance with its wrapper, cleaned for the public page.

Returns: `String`

### opt.template

Type: `property`

The `<template>` section of the widget.

Returns: `String`

`CLASS` is already replaced. It is `undefined` when the widget has no template.

### opt.id

Type: `property`

The identifier of the instance.

Returns: `String`

The value of `data-cms-id`.

### opt.widget

Type: `property`

The identifier of the widget.

Returns: `String`

### opt.url

Type: `property`

The address of the page, such as `/about-us/`.

Returns: `String`

### opt.page

Type: `property`

The page that is being built.

Returns: `Object`

Its properties include `id`, `name`, `title`, `description`, `keywords`, `url`, `language`, `layoutid` and `parentid`.

### opt.vars

Type: `property`

The variables of the site, as keys and values.

Returns: `Object`

### opt.breadcrumb

Type: `property`

The path from the top page to the current page.

Returns: `Array`

An array of pages with `id`, `url`, `name`, `title`, `icon` and `language`. The first has `first: true` and the last has `last: true`.

### opt.navigation(id)

Type: `method`

Returns a menu of the [Navigation](/cms/1-0/guides/navigation/) screen.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `id` | `String` | yes |  | The identifier of the menu. |

Returns: `Object` The menu.

The menu has `children` (the visible links), `links` (all links), `current` (the link of the current page) and `selected: true` on the current link and its parents.

### opt.mobile

Type: `property`

`true` when the visitor uses a mobile device.

Returns: `Boolean`

### opt.robot

Type: `property`

`true` when the visitor is a search engine robot.

Returns: `Boolean`

### opt.ua

Type: `property`

The parsed user agent of the visitor.

Returns: `Object`

An object with `os`, `browser` and `device`.

### opt.user

Type: `property`

The user of the request.

Returns: `Object`

It is `undefined` for anonymous visitors.

### opt.controller

Type: `property`

The Total.js controller of the request.

Returns: `Object`

Use it to read headers, the query or cookies of the request.

### next(content, [replace], [cache])

Type: `method`

Gives CMS the content of the instance.

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `content` | `String` | yes |  | The HTML of the instance. |
| `replace` | `Boolean` | no | `false` | `true` replaces the wrapper too. An empty content then removes the instance. |
| `cache` | `Boolean` | no | `false` | `true` keeps the result until CMS builds the page again. |

Call it once, also when something fails. Without `replace`, the content goes inside the wrapper of the instance.

Example: Replace the instance with an import element
```js
exports.render = function(opt, next) {
	next('<ui-import config="url:{0}"></ui-import>'.format(opt.config.url), true, true);
};
```
