Add Support for Specific Extensions to a Bolt Theme

Phillipp
Bolt CMS
Published in
1 min readMay 26, 2016

If you are building a public Bolt theme, it might be helpful to provide support for common extensions like the Disqus and Facebook comments extensions.

This way, your users just have to install the theme and don’t need to edit any template files at all. 🚀

The following section won’t cover how to implement extensions but how to check if they are installed so your theme doesn’t break badly. 💥

Check If an Extension Is Installed in Bolt 2

{% if Disqus is defined %}
... doing the implementation
{% endif %}

Check if an Extension is Installed in Bolt 3

{% if app.extensions.get('bolt/disqus') %}
... doing the implementation
{% endif %}

Show Which Extensions Are Supported

Supporting third party extensions is one thing, showing which ones is another.

There is a very simple way to mark specific extensions as supported. Simply add the following section to your composer.json in your extension:

“suggest”: {
“bolt/disqus”: “Add Disqus comments to your entries.”
},

Now they are not only defined in a centralized place which is good for parsing the information. They are also shown on the theme detail page in the Bolt Extension Store.

And of course, you can also note them in your README, which I highly recommend too.

--

--