AEM Recipes
Goal-oriented walkthroughs that connect the reference pages on this site into complete workflows. Each recipe is a short checklist with links to the detailed pages.
Build a configurable component
- Scaffold the component and HTL -- Your First Component.
- Write the markup with HTL and a Sling Model for logic.
- Add an authoring dialog with the fields authors need.
- Add validation for any business rules (and re-check in the model).
- Allow it in a template policy so authors can place it.
Add a dynamic dropdown to a dialog
- Add a
selectwith adatasourceresource type -- Component Dialogs: datasource. - Implement the datasource servlet that builds the options.
- Read the saved value in your Sling Model.
Deliver content headlessly (GraphQL)
- Model the content as a Content Fragment Model.
- Author fragments in the Content Fragments Console.
- Enable the model and create a GraphQL endpoint.
- Save a persisted query and fetch it from your frontend -- headless end-to-end.
- Configure CORS, the referrer filter, and caching for production.
Make a slow query fast
- Run the query through the Explain Query tool to confirm whether it traverses -- Search & Indexing.
- Tighten the
pathandtypeconstraints. - Define an Oak property or Lucene index that matches the filter + sort.
- Deploy the index under
/oak:index(use the-custom-Nconvention on AEMaaCS) and reindex.
Bulk-edit existing content
- Write a guarded script in the Groovy Console (always start with
DRY_RUN = true). - Iterate in batches and
session.save()periodically. - Review the dry-run output, then flip
DRY_RUN = false. - For repeatable jobs, schedule the script or trigger it from CI.
Publish content (and its dependencies)
- Use Manage Publication to activate a page with its references (assets, fragments, tags,
/conf). - Confirm the replication/distribution completed.
- Verify the Dispatcher/CDN cache was flushed.
Automate a content process
- Model the steps as a workflow (process + participant steps).
- Wire a launcher to start it on the right JCR change.
- For high-volume, non-interactive work, prefer a Sling Job instead.
Secure a section of the site
- Model roles as groups and ACLs; assign permissions to groups.
- Define them as code with repoinit so environments stay consistent.
- For gated delivery, apply a Closed User Group to the content root.
- Harden the Dispatcher with deny-by-default filters.
Debug "my component isn't rendering"
- Is the bundle Active and the DS component satisfied? Check the OSGi consoles.
- Which script rendered? Check Recent Requests and
sling:resourceType. - Did the dialog value persist? Inspect the node in CRXDE Lite.
- Still stuck? Attach a remote debugger and set a breakpoint in the model.
Translate a site
- Create language copies of the master language.
- Configure the Translation Integration Framework and a connector.
- Register custom translatable properties in translation rules.
- Translate UI strings with i18n dictionaries.
See also
- AEM Beginners Guide - the full learning path
- AEM Glossary - terminology
- Architecture - how the platform fits together