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.

up vote 7 down vote accepted

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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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