Create your first site

Create the garden blog, open it in your browser, and sign in to its admin.

Start with a running Zotonic node from your installation route. Run the commands below from the repository root, inside the container or Nix shell if you chose one.

1. Create the example site

bin/zotonic addsite -s blog -H garden.test garden
bin/zotonic status

The command creates apps_user/garden, prepares the database schema, compiles the application, and starts it on the running node. Expect garden to reach the running state. Keep the generated admin password shown in the output; you need it for the next step.

2. Give your browser the local hostname

On the computer running your browser, add this line to its hosts file using an administrator-enabled text editor:

127.0.0.1 garden.test

The file is /etc/hosts on macOS/Linux and C:\Windows\System32\drivers\etc\hosts on Windows. For containers, edit the computer's hosts file, not just the container's. Keep any existing entries. You can skip this step if your local DNS already resolves garden.test to this machine.

3. Open the site and admin

Open your garden site in the browser. These examples use the default development HTTPS port 8443; use your configured port if different. Expect the blog home page. The generated development certificate may need a local browser exception.

Open the garden admin and log in as admin, using the password printed by addsite. These are your site's credentials, separate from the status site's wwwadmin account.

4. Make your first change

Open apps_user/garden in your editor, then follow Change a template and see the result. There is no need to create a custom module first.

If the wrong site opens, check the hosts entry and priv/zotonic_site.config hostname. If creation fails, read the error and inspect the partially created directory before retrying. Native database problems can be checked with Prepare local PostgreSQL; containers use database host postgres. See addsite options for a non-default configuration.

Site configuration and enabled modules

A site is identified by its application and priv/zotonic_site configuration. Supported formats include Erlang .config, JSON, and YAML; follow the format already used by the project.

For Erlang configuration, the file is a list of terms ending with a period:

[
    {enabled, true},
    {environment, development},
    {hostname, "garden.test"}
].

This is a small fragment illustrating syntax, not a replacement for the generated database and module settings.

Inspect the actual configuration sources with siteconfigfiles garden and siteconfig garden. A site's installation module list and its current activation state are different concerns, especially on database-backed sites. Verify enabled modules in the admin or module manager.

Referred by

Developer guide

Create a page layout

Use an existing site base template as your starting point. Put shared document structure in the base and page-specific markup in blocks.

Modules

mod_email_receive

Enables the Zotonic site to receive emails for the site’s users. The user’s email address is username@hostname, where the hostname is the hostname as…

Modules

mod_email_relay

This module supports relaying email between Zotonic servers.

Developer guide

Follow a request to its template

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.