Cookbook
Cookbooks are recipes with a solution to howto questions or functionality of Zotonic.
For more generic guides, check the User Guide and the Developer Guide.
Cookbooks are recipes with a solution to howto questions or functionality of Zotonic.
For more generic guides, check the User Guide and the Developer Guide.
Browse recipes
45 items
Choose a survey form or implement a validated server-side mail handler.
Add a plain-text callout block using current admin field names.
Use an admin widget and the existing resource form.
Use a filter for a small transformation of an input value. Keep missing and unexpected values predictable, and escape output at the point where it becomes HTML.
Use a current search notification and let Zotonic apply resource visibility.
Use controller_template when a dispatch rule only needs to render a template. Write a custom controller when the endpoint needs additional request processing or response behavior.
Use icons from the loaded theme and keep the control accessible.
Use a small active module or site template override.
Add a gen_server and verify that its supervisor restarts it.
Override the smallest category-specific admin component.
Common markup in admin templates.
Add membership after creation with explicit permissions.
Return a fixed local destination from the current signup notification.
Use shell completion without relying on a particular startup mode.
Render escaped text through the current zotonic_scomp behaviour.
Build a small standalone OTP application using Erlang/OTP 28 and Rebar3.
Render the navigation menu on a named page.
Wrap a maintained Zotonic action instead of assembling JavaScript strings.
Create apps_user/zotonic_mod_garden with the following files. This example adds a discoverable module without starting an extra process.
Override the error template while preserving the response status.
Reuse the maintained authentication flow and override its presentation.
Enable an installed module on one site and verify the result.
Create src/models/m_garden.erl in the Garden module. This complete example exposes a public greeting:
Create a pivot column and fill it through the custom_pivot notification.
Discover actual metrics before configuring subscriptions.
Keep UTF-8 characters intact while transforming user text.
Find the active template and its path relative to priv/templates. Create the same relative path in your site or another active module with a higher selection priority.
Search uses database indices on special pivot columns and full text fields.
Create and check the database used by a native development installation.
Use the current resource rather than parsing its URL.
Restore into isolation and verify content, media, and access.
Choose escaping for the value and the output context.
Reset a normal user identity when the usual recovery flow cannot be used.
Use the current signup notification and make follow-up work repeatable.
Use the form parser deliberately and distinguish it from direct property updates.
Queue a complete callback and distinguish enqueueing from completion.
Configure the installed Logger handler and verify delivery.
Pass values explicitly and keep browser code in the supported script tag.
Use the maintained growl action with the normal browser assets.
Connect one image and render it without constructing inline CSS from input.