Share a widget with the official repository
Prepare a widget for the official catalogue and send it to the repository.
On this page
The official widgets live in the GitHub repository totaljs/cms-widgets. To offer your widget to every CMS user, send it there as a pull request.
Prepare the file
- Name the file after the identifier:
exports.id = 'opening'goes inwidgets/opening.html. The catalogue uses the file name as the identifier, and the Import widgets window compares it withexports.idto mark installed widgets. - Choose an identifier that no official widget uses. The list is in Official widgets.
- Fill in
exports.name,exports.author,exports.versionandexports.preview. Write each of them on one line that ends with;, because the catalogue reads these lines on their own. - Embed the preview as a
data:URI, so the widget stays one file. - Keep everything in the one file: styles, settings, scripts and the sample content.
Check the widget
Before you send it, install the file in a CMS with Options > Create and check that:
- the sample content of
<body>looks right in the editor and on the public page; - every setting does what its label says, also when you apply it twice;
- the parts that the user must change have the right editor classes;
- the page looks right on a phone.
The catalogue
The repository has a db.js script that builds db.json, the catalogue, from the files in widgets. For each file it stores the identifier (the file name), the name, the preview, the author and the address https://cdn.totaljs.com/cms/<file>. The maintainers publish the files and the catalogue on the CDN, and CMS reads the catalogue from there.
Send it
- Fork totaljs/cms-widgets on GitHub.
- Add your file to the
widgetsfolder. - Open a pull request that says what the widget shows and lists its settings.