Developer guide
Browse by topic
Explore related documentation through its most useful keyword groups.
166 items
Grouped by Domain
Building inspecting testing and diagnosing Zotonic applications and modules.
Explore this clusterCreating configuring updating starting and stopping Zotonic sites.
Defining site module runtime and service settings.
Installing activating configuring upgrading and removing Zotonic modules.
Recording and observing events errors state health and performance.
Explore this clusterMapping incoming URLs to controllers resources or redirect destinations.
Managing files and media resources throughout their lifecycle.
Defining content types properties relationships and constraints.
Preserving and recovering site data media and configuration.
Documentation not covered by the other keyword groups in this split.
Prefer Zotonic models for resources and edges. Use z_db for application tables or queries that the model APIs do not cover.
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 controller_template when a dispatch rule only needs to render a template. Write a custom controller when the endpoint needs additional request processing…
Create a site application from a skeleton.
Use an existing controller and a template for a simple dynamic page.
Check the requested path and compare its binary segments with the model callback patterns. Confirm that the callback returns the unused path in the required…
Open module management for the correct site. Check whether the module is disabled, waiting for a dependency, or failing during startup.
Check that the module is an Erlang application in a discovered project directory. Confirm the application name, .app.src, main mod_... module, and successful…
A reusable module normally lives in apps_user/zotonic_mod_garden and contains:
A typical site contains the following directories. Create only the extension directories you actually need.
Check whether the resource has an original file and whether its media information describes that file correctly. Then inspect the preview request in the…
Measure one representative request and identify whether time is spent in the browser, network, or server. Compare an initial request with a repeated request to…
Use distinct, consistent names so code and assets can be found without ambiguity.
OTP application startup concerns the application and its processes. Zotonic module activation concerns the feature within an individual site.
Check each stage in order: the edited file, build output, loaded application, active module, selected template, and browser response.
Run bin/zotonic status to distinguish an unavailable node from a stopped or failing site. Inspect the relevant startup log before repeatedly restarting it.
Run bin/zotonic status to distinguish an unavailable node from a stopped or failing site. Inspect the relevant startup log before repeatedly restarting it.
Confirm the hostname, site, and path from the actual request. Use the dispatch trace to see the selected rule and any rewritten path.
Zotonic's file handler watches source changes when a supported watcher is available. Erlang, templates, dispatch files, and assets have different handlers.
For a site with backup support enabled:
List, create, or restore backups.
Keep source files such as SCSS in priv/lib-src and compiled assets in priv/lib. Use an app-level Makefile that delegates asset work to the source directory's…
Keep source files such as SCSS in priv/lib-src and compiled assets in priv/lib. Use an app-level Makefile that delegates asset work to the source directory's…
Compile Zotonic, start it, check the status page, and continue to your first site.
First measure the work performed by the fragment. Cache a fragment only when you know which inputs and data changes affect its output.
Start with a narrow VCL 4 policy and preserve authenticated responses.
Use bin/zotonic setconfig only for a global setting that supports a runtime change. The command changes the running configuration and does not save the value…
Make a small visible change before building a larger feature.
Render the changed page with realistic content. Include missing optional fields, a long title, several list items, and a second language when applicable.
Open Cross-reference check of templates in the Development page and run the check. Read each reported reference with the active module set in mind.
Start with the symptom and use the smallest tool that explains it.
Choose a model, controller, observer, or component.
Choose checks for a change.
Choose checks for a change.
Open a site in Chrome.
Open a site in Chromium.
Use make for the normal project build. On a running development node, the CLI also provides focused operations:
Recompile one Erlang source file.
Request recompilation on the running node.
Display configuration resolved from files.
List selected global configuration files.
Check whether global configuration files can be read.
Align DNS, site selection, and certificate termination.
Set a relay at the correct scope and test a real site message.
Identify where the site's archive files, generated previews, backups, and security files are stored. These have different retention and recovery needs.
Test the configured PostgreSQL connection.
An edge connects a subject resource to an object resource through a predicate. Use model#edge to inspect and manage these connections.
From the checkout root:
Build the checkout, verify the change, and send a focused pull request.
Use an existing site base template as your starting point. Put shared document structure in the base and page-specific markup in blocks.
Use an existing site base template as your starting point. Put shared document structure in the base and page-specific markup in blocks.
Create apps_user/zotonic_mod_garden with the following files. This example adds a discoverable module without starting an extra process.
Prepare a site database and schema.
Create the garden blog, open it in your browser, and sign in to its admin.
Create the garden blog, open it in your browser, and sign in to its admin.
Create the garden blog, open it in your browser, and sign in to its admin.
If you are building a website then you might want to use the standard dialogs, overlays, authentication and other parts of Zotonic. To make those look like…
Start Zotonic in the foreground with an Erlang shell.
Decrypt a local encrypted backup file.
The main site or module can declare:
Record the code revision, build steps, configuration changes, and schema changes for the release. Build and test the same revision in an acceptance environment…
Build, inspect, and maintain Zotonic sites and modules.
Reproduce one action with the browser console and network panel open. Check for a JavaScript error before the request, a failed request, or a successful…
Inspect dispatch rules or trace a URL.
Define reusable image sizes in priv/templates/mediaclass.config and use them in image tags. For example, a local mediaclass can constrain an image's width:
Define reusable image sizes in priv/templates/mediaclass.config and use them in image tags. For example, a local mediaclass can constrain an image's width:
First check which file is selected and whether the changed code compiled. Then repeat the request with the relevant cache disabled or flushed.
Sign in to the local site's admin as an administrator. Open the module management page, find Development (mod_development), and activate it if necessary.
These terms describe different parts of the system.
Inspect active Erlang processes.
Start from the site's existing model API or controller patterns. Specify the method, input fields, response shape, and errors before connecting a browser or…
Create src/models/m_garden.erl in the Garden module. This complete example exposes a public greeting:
Open Show an overview of all observers from the Development page. Find the notification and inspect the registered callbacks and their order.
Distinguish global Zotonic configuration, Erlang runtime configuration, site configuration files, and module settings stored for a site. Similar setting names…
The status site manages the running Zotonic installation. A site's /admin manages that site's content and enabled modules. They have different scopes and can…
Enable module#mod_development and open its template tools in the admin. Search for the template name and inspect the selected file and alternatives.
Flush site caches.
Start with the URL that gives an unexpected result. Check its hostname: Zotonic uses it to select a site before matching the site's dispatch rules.
Start with the URL that gives an unexpected result. Check its hostname: Zotonic uses it to select a site before matching the site's dispatch rules.
Choose a release or a development checkout and follow the installation guide.
Use scomp#wire to connect a browser event to an action or a server postback. Give the target element a stable ID within the rendered page.
Use scomp#wire to connect a browser event to an action or a server postback. Give the target element a stable ID within the rendered page.
Zotonic indexes resources from the site's active modules. A file existing on disk is not enough: its application must be discoverable, and its module must…
Use the command suited to the question:
Use bin/zotonic logtail for the configured console log, or select error or crash when those files are available. The command prints the last 500 lines and…
Open Dependency graph of all available templates from the Development page. Use the graph to understand inheritance and include relationships before changing a…
Prepare an environment and deploy a release with a recovery plan.
Use a datamodel for application-owned categories, predicates, resources, and relationships that must exist when a module is installed.
Install the native tools, prepare PostgreSQL, and build a local checkout.
Build and run Zotonic with its development containers, then create a site.
This is the Zotonic Developer Guide. It takes you through all aspects of Zotonic so you can start building your own sites as quickly as possible.
Keep development and production settings distinct.
Keep development and production settings distinct.
Use the request context when checking access to data and actions. A hidden button is not an authorization check: callers can invoke a model or endpoint…
Use a resource's page URL when linking to content. This lets Zotonic account for its path and language.
Load changed BEAM files.
Print recent lines from a configured log file.
Use a category to describe what a resource is, such as an article or event. Use a predicate to describe a relationship between two resources, such as an author…
Export structured resource data and record how source resources map to destination resources. Match stable names or URIs deliberately; do not assume that…
Open the site URL in a browser.