🚀 Ship faster with premium components 🚀
Search documentation v1.5.0

Shortcodes

Insert dynamic content with placeholders

Shortcodes are small placeholders you can write directly into any text field or block prop in the CMS. When content is rendered on the frontend, each shortcode is automatically replaced with its resolved value. No configuration is required. Shortcodes work out of the box across all fields and all block values.

Available Shortcodes

The CMS comes with the following built-in shortcodes that resolve to date values based on the current server time:

ShortcodeResolves toExample output
[year] The current four-digit year 2025
[month] The current month name, localized to the entry locale January
[day] The current day of the month, localized to the entry locale 14

Month and day formatting respect the locale passed to getContentType or getContentEntryById. For example, with a locale of en-US, [month] resolves to January. With a locale of fr-FR, the same shortcodes would resolve to janvier. Shortcodes can be placed anywhere inside a text value, on their own or inline with other content:

Unlock CMS
Example usage of shortcodes
Copyright [year] Acme Inc.
Last updated [month] [day], [year]
Welcome to our [month] edition

They work in any input field, textarea, or block prop that accepts a string value. There is no special syntax required beyond writing the shortcode as-is.

Adding Custom Shortcodes

Shortcodes are resolved in resolveShortCodes.ts. To add your own, extend the function with an additional .replaceAll call:

Unlock CMS
How to add custom shortcodes
// Add at the end of the return
.replaceAll('[your-shortcode]', yourResolvedValue)

The shortcode name can be any string wrapped in square brackets. The resolved value can be any string. A static constant, a value derived at render time, or anything else available in scope. As this function runs on the server, you can even fetch data from your database to populate shortcodes if needed.