Hosting
UI Extensions are independent HTML5 applications loaded into an iframe. As every other static resource, they need to be hosted so the browser can fetch the file. Contentful support two types of hosting.
Contentful hosted
The extension's source code is uploaded to Contentful as a bundled string where all local dependencies need to be inlined into one single file. Internal extensions are uploaded by using the srcdoc
property and have a limit of 512kb (uncompressed). Use internal hosting if you don't want to host anything on your own and can accept the drawbacks (need for a non-standard build, file size limitation).
For example, the following CLI command
$ contentful extension create \
--name MyExtension \
--field-types Symbol \
--srcdoc index.html
creates an extension of name MyExtension
for the field type Symbol
. The code of the extension is uploaded to Contentful using the srcdoc
property.
Third party hosted
The extension's source code is uploaded to a third party server by using the src
property. Relative links in the root HTML are supported as expected. Any platform (such as S3, Heroku, personal corporate server, etc) is supported, provided it supports CORS policy and is available through HTTPS.
Use third party hosting when you want to be as flexible as possible with your development and deployment process.
For example, the following CLI command
$ contentful extension create \
--name MyExtension \
--field-types Symbol \
--src https://www.example.com/extensions/myextension/index.html
creates an extension of name MyExtension
for the field type Symbol
. The code of the extension is third party hosted and hence its URI is provided as the src
property.
Next steps
Not what you’re looking for? Try our FAQ.