Spanish Total.js
English
Documentation For AI agents
Contents

Share a widget with the official repository

Prepare a widget for the official catalogue and send it to the repository.

.md GitHub
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 in widgets/opening.html. The catalogue uses the file name as the identifier, and the Import widgets window compares it with exports.id to mark installed widgets.
  • Choose an identifier that no official widget uses. The list is in Official widgets.
  • Fill in exports.name, exports.author, exports.version and exports.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

  1. Fork totaljs/cms-widgets on GitHub.
  2. Add your file to the widgets folder.
  3. Open a pull request that says what the widget shows and lists its settings.
Made in Europe