# Minimal CMS block

**URL:** <https://forum.shopware.com/t/minimal-cms-block/72945>\
**Category:** Programming (EN)\
**Created:** [22. Februar 2021 um 16:48 UTC](https://forum.shopware.com/t/minimal-cms-block/72945 "2021-02-22T16:48:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JoAnneWDT](https://avatars.discourse-cdn.com/v4/letter/j/e19adc/32.png) [@JoAnneWDT](https://forum.shopware.com/u/JoAnneWDT)\
**Post date:** [22. Februar 2021 um 16:48 UTC](https://forum.shopware.com/t/minimal-cms-block/72945/1 "2021-02-22T16:48:49Z")

</div>

I try to create a custom CMS block to be dragged+dropped into a page.

It shows in the intended manner as a preview in the list of CMS blocks, one of the text blocks.

> But when I try to drop it into a page, I get the error: Uncaught TypeError: Can’t convert undefined to object. The index.js in the CMS block map looks like this:
> 
> import ‚./component‘; import ‚./preview‘;Shopware.Service(‚cmsService‘).registerCmsBlock({ name: ‚trainings-list‘, label: ‚sw-cms.blocks.general.label‘, category:‚text‘, component: ‚sw-cms-block-text-trainings-list‘, previewComponent: ‚sw-cms-preview-text-trainings-list‘, defaultConfig: { } });

The index.js in the component map like so:

> import template from ‚./sw-cms-block-text-trainings-list.html.twig‘; import ‚./sw-cms-block-text-trainings-list.scss‘;Shopware.Component.register(‚sw-cms-block-text-trainings-list‘, { template });

And the component twig.html is empty.

> {% block sw\_cms\_block\_text\_trainings\_list %} {% endblock %}

Apparently I have done something wrong, or didn’t use the proper syntax, maybe I have to add something but I can’t find the solution. What am I missing?

&nbsp;

---

<div class="post-metadata">

**Author:** ![ninja](https://avatars.discourse-cdn.com/v4/letter/n/53a042/32.png) [@ninja](https://forum.shopware.com/u/ninja)\
**Post date:** [13. Juni 2021 um 17:15 UTC](https://forum.shopware.com/t/minimal-cms-block/72945/2 "2021-06-13T17:15:22Z")

</div>

Do you also have a main.js file where you imported your module?
