Examples

What mothwing does, part by part, past getting started. Every option is in the API reference.

  1. Data

    Every file in src/data/ is in every page by its name. home.json is {{ home }}, a folder is an object of its files. A .js file's default export is its value, called first when it's a function, for data worked out at build time:

  2. Loops

    <x-each> repeats its content per item, index="i" names the item's position, from 0. <x-if value="..."> shows its content when the value is there and not empty, not="..." when it isn't. On a line or lines of their own, they leave no empty lines behind and their content keeps the indent it would have by hand.

  3. Pages

    src/pages/about.html is /about/, src/pages/projects/index.html is /projects/.

  4. Tags

    Paths in tags start at src/, the same as the URLs in the build.

  5. Making it yours

    Your own tags, transforms and hooks, in the config, for what's only your site's:

  6. Going live

    What a site turns on before it's published, each off until the config asks for it: