Quickstart

Create a site, preview it, edit a page in the admin UI, and build it.

This takes a few minutes and needs only the motabhai binary; see Installation.

1. Create a site and start the dev server

motabhai new mysite     # or: --theme engineering-fantasy, or --tailwind
cd mysite
motabhai serve          # http://127.0.0.1:5000/

motabhai new creates the directory with a config, models, some content and two themes, which hold the templates and stylesheets. It refuses a directory that already has files in it. The site is named after the directory. It uses the plain theme; --theme engineering-fantasy starts with the other, which has a sidebar, post cards and the latest posts on the home page. With --tailwind the starter is styled with Tailwind CSS instead.

2. Look at the site

Open http://127.0.0.1:5000/. The starter site has a home page, an about page, a blog with one post and a projects page with one project. Every page the dev server serves has an Edit button in the corner.

The starter site's first blog post, with the Edit button in the bottom right corner

3. Open the admin

Open http://127.0.0.1:5000/admin/, the dashboard (see The admin UI), and choose Pages (http://127.0.0.1:5000/admin/pages). It lists every page of the site as a tree, with each page's path and model.

The admin's Pages screen, beside the tree: Welcome, About, Blog with the post Hello, world, and Projects with An example project

4. Edit a page

Click a page in the tree, or the Edit button on the page itself. A post opens as a document: its title, a Properties panel with its other fields, and its text, shown formatted as you type. Split shows a live preview of the page beside it. Save with the button below or with Ctrl+S (Cmd+S on a Mac). New in the bar at the top, then New Blog post, creates a new post, and Themes changes the site to the other theme.

The edit page for the post Hello, world: a large title, a closed Properties panel, and the text with its code block shown formatted

Saving writes content/blog/hello-world/index.md. You can edit that file, a template or the stylesheet in your editor instead, and the browser reloads in the same way.

5. Build the site

motabhai build          # writes the finished site to public/

public/ now holds plain HTML, CSS and images, ready for any static host. The starter's .gitignore already lists public/ and .motabhai/, the build state directory.

6. Publish it

The starter includes a GitHub Actions workflow and a github-pages deploy target, so pushing the site to a GitHub repository is most of the work. Deploying explains the remaining settings, and the other targets.

What the starter contains

mysite/
  motabhai.toml          # name, url, language, theme and the deploy target
  models/
    page.toml            # a page: title and body
    blog.toml            # the blog index: lists posts newest first, with a page per tag
    blog-post.toml       # a post: title, date, summary, tags, body
    projects.toml        # the projects page: lists projects
    project.toml         # a project: title, summary, link, body
  content/
    index.md             # the home page
    about/index.md
    blog/
      index.md
      hello-world/index.md
    projects/
      index.md
      example-project/index.md
  databags/menu.toml     # the navigation menu, read with bag("menu")
  themes/
    plain/               # the theme in use
      templates/
        layout.html      # the HTML skeleton every page extends
        page.html        # one template for each model, and tag.html
        ...
      assets/css/main.css
    engineering-fantasy/ # the other theme, to change to
      templates/         # the same, and card.html for its cards
      assets/css/main.css
  .github/workflows/deploy.yml
  .gitignore

From here, Project layout and configuration explains each of these. To change a template, edit it in the theme, or put a file of the same path in the site's own templates/, which replaces the theme's; see Themes.