4

I need to define a component in YAML manifest files in Sitecore JSS CodeFirst approach, where component doesn't have any "Data Source Template" field populated.

In this case, NO template should be created for this component in template section also.

1 Answer 1

8

This can be done by defining a component in the manifest that has no fields, for example:

Without Datasource

import { addComponent } from '@sitecore-jss/sitecore-jss-manifest';

export default (manifest) => {
  addComponent(manifest, {
    name: 'Welcome',
  });
};

With Datasource

import { addComponent, CommonFieldTypes } from '@sitecore-jss/sitecore-jss-manifest';

export default (manifest) => {
  addComponent(manifest, {
    name: 'Welcome',
    fields: [{ name: 'title', type: CommonFieldTypes.SingleLineText }],
  });
};

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.