Issue
- I would like to know an easy way to create web contents programmatically.
Environment
- Liferay DXP 2023.Q4
Resolution
NOTE: The following resolution requires customization and should only be implemented at the discretion of your team. Liferay Support will not be able to assist with designing or implementing customizations.
Site Initializers approach
- If you know in advance the articles you want to create, you can consider doing something similar to what is done for Site Initializers.
- You can see an example in the lfrsales repository.
- Also, you can check the code in modules/apps/site-initializer.
JournalConverter
- The JournalConverter is commonly used in the product code to deal with content conversions.
- For instance, consider the StructuredContentUtil introduced in 7.4 for the
headless-delivery
module. This class can be used to retrieve content as a String fromDDMFormValues
. It's referenced in StructuredContentResourceImpl.