-
-
Notifications
You must be signed in to change notification settings - Fork 702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document config.blocks.initialBlocks
#6532
Comments
Proposed Update to the DocumentationInitial Blocks Configuration in VoltoThe Example: Setting Custom Initial BlocksHere’s how to configure the Basic Example: const initialBlocks = {
Document: ['leadimage', 'title', 'text', 'listing'],
}; This configuration ensures that when a new Document is created, it initializes with the following blocks in order:
Advanced Example: Full Block Configuration: const initialBlocks = {
Document: [
{ '@type': 'leadImage', fixed: true, required: true },
{ '@type': 'title' },
{ '@type': 'slate', value: 'My default text', plaintext: 'My default text' },
],
}; Disabling New Blocks and Requiring Specific BlocksFor scenarios where you want to restrict users from adding new blocks or make certain blocks mandatory: Configuring Required and const initialBlocks = {
CustomContentType: [
{ '@type': 'title', required: true, fixed: true },
{ '@type': 'listing', required: true, fixed: true },
],
};
Schema Automation for Required and DisableNewBlocks: Overwriting Block Behavior for a Custom Content TypeTo modify block behavior specifically for one content type without affecting others, you can shadow components. For example, to customize the title block for a specific content type:
Restricting Blocks to Enforce LayoutTo enforce that a content type only allows specific blocks (e.g., title and listing), define const blocksConfig = {
CustomContentType: {
allowedBlocks: ['title', 'listing'],
initialBlocks: [
{ '@type': 'title', required: true },
{ '@type': 'listing', required: true },
],
},
}; This ensures that only the Adding Listing Block CustomizationThe Listing block can also be configured with advanced settings like Example Configuration: const listingBlockConfig = {
allowed_headline_tags: [['h2', 'h2'], ['h3', 'h3']],
};
|
May I work on this issue? Please Assign this to me |
@KshitizRana no. Please read and follow First-time contributors, especially Things not to do, Contribute to documentation, and Contributing to Volto. |
Got it ! |
I would like to work on this issue. |
@Ratangulati you can claim this issue by writing an explicit comment such as "I am working on this issue" to let others know not to duplicate your effort. Thank you! |
@Ratangulati I am working on this issue. |
Update:
https://6.docs.plone.org/volto/blocks/settings.html#initialblocks-initial-blocks-per-content-type
See:
@polyester @fredvd @nileshgulia1 @sneridagh @ziming-yuan
The text was updated successfully, but these errors were encountered: