Metafields / Predefined fields

Many times I found myself creating the same identical field for multiple content models. 90% of the times it happens with strings and images.

If the field has an extensive validation and presentation or, if I need to ensure that the field ID is consistent across the models it becomes time consuming copy/pasting the validation, the presentation and checking if the field ID matches.

Blocks are amazing for loops but sometimes one field is all I need to add.

Cosmic CMS has a similar feature named Meta fields where the field is set once and then used in any model.

Thank you very much for your attention and for your incredible product.

@alienopolis20 right now something that you can do is a modular content with a single type of blocks and with a requirement of 1 block. In that instance we create automatically the block for the editor.

Looks like what you need? What do you think?

Hi @mat_jack, of course I have tried this already and it is a valid option to reach the goal but I find the experience for the editors not great as when they already find the field “ready” in the model.

If the modular field lives inside of a fieldset, the interface becomes a bit confusing especially when there are other modular fields used for the same purpose. Moreover the gql query always returns an array for any block.

In such case I prefer to copy/paste the field settings.

Thank you very much for your answer.

1 Like

I don’t think the single block approach is suitable for either of the described needs. If a block field would contain meta data (e.g. title) which would only used to identify contents within the content admin interface, you would not be able to see this on the tabular view nor would you be able to filter/search content by that as you can only do that for non-nested fields.

Based on what I’ve found out at this point, you could partly overcome the limitation by adding a computed field which would be populated from the nested content. But this would beat the purpose as then you’d need to add the required computed field(s) and configure it with a script to do this which would create it’s own maintenance challenges.

Similarly if you’d like to add to predefined slug field with site wide restrictions, you would not be able to use it to (directly) query the content as deep filtering is not currently supported.

1 Like