When creating a Content Fragment Model there is a data type of "Content Reference". This allows the content author to browse and select content within AEM. The data type has validation options where only specific content types are allowed in the property.
Make this field only accept specific content types:
In our case we are hybrid headless so much of the content is traditional pages. We have a use-case in a content fragment where the user should only select a Page. Is there any way to do so?
AEM 6.5.17
AEM 6.5.18
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
There is a way to make the "Content Reference" field in a Content Fragment Model only accept specific content types, including Page. To do this, you will need to use the "Allowed Content Models" validation option. This option allows you to specify a list of content models that are allowed to be referenced in the property.
To make the field only accept the specific content types you listed, you would add the following content models to the "Allowed Content Models" list:
This will ensure that the content author can only select content from these models when editing the property.
Here are the steps on how to add the "Allowed Content Models" validation option:
Once you have added the "Allowed Content Models" validation option, the content author will only be able to select content from the specified models when editing the property.
Views
Replies
Total Likes
Thanks for the reply!
It is possible I am missing something, but I don't think the instructions work on AEM 6.5.17 or 6.5.18. Perhaps this is a cloud solution?
A few notes though...
Regarding this:
To do this, you will need to use the "Allowed Content Models" validation option. This option allows you to specify a list of content models that are allowed to be referenced in the property.To make the field only accept the specific content types you listed, you would add the following content models to the "Allowed Content Models" list:
- ContentFragment
- PlainText
- RichText
- Image
- Audio
- Video
- PDFDocument
- Spreadsheet
- Presentation
- Archive
- Markup
- Page
Since a page is not a content fragment I am using a Content Reference instead of a Fragment Reference. From what I can tell, the ability to select and restrict the allowed content models would not apply in this case. I think the items listed in the drop down and shown in the bulleted list for this post are content types not fragment models. A content model would be a model created by an administrator or super user such a Adventure, Author or Article on the WKND site. Image, Audio, PDF Document, etc would be content types.
As noted originally, when creating a Content Reference data type, page is not a validation choice for "Accept only specified content types"
Views
Replies
Total Likes
Views
Likes
Replies