Custom widgets let you integrate powerful functionalities into your stack that let you analyze your entry content and recommend ideas. Some examples of custom widgets are SEO tag recommendations, sentiments analysis, and language translation.
Add Custom Widgets
There are two ways to add a custom widget to a content type: Create New or Use Prebuilt Template. Refer to our general guide given below on creating a new custom widget. Or, scroll down to the next section to learn how to use prebuilt templates.
Create new custom widgets
In this guide, we will learn how to build a new custom widget from the ground up. Let’s look at the steps involved in creating and deploying the custom widget in Contentstack.
Go to Settings > Extensions.
Click Add Extension and select Create new.
From the two options, select Custom Widget.
On the page that appears, enter values in the fields as given below:
Title: Provide a suitable title for your custom widget. This title will be visible as a widget name in the entry page.
Hosting method: Select how you wish to host the widget. If you select ‘External Hosting’, you need to provide the URL on which you have hosted the widget, in the URL field that appears below. If you select ‘Hosted on Contentstack’, you can write the code in the ‘Extension source code’ that appears below after selecting this method.
External source code: Enter your custom widget’s source code. You can find an example here.
Config Parameter: If you have used any config parameters (such as access token) in the source code, specify the value of the parameters in the ‘Config Parameter’ field.
Scope: Select which content types this widget will be available for. You can choose All Content Types or Specific Content Types.
Click ‘Save’. This will create your custom widget extension.
Once your custom widget is created, you will be able to use them in the entries of the specified content types.
Use prebuilt templates
Contentstack provides certain prebuilt custom widget templates, so that you can get started instantly instead of writing code. You just need to configure these templates a bit and get started.
Below is the list of prebuilt templates that Contentstack provides: