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. projects.json is {{ projects }}, 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. <x-if value="..."> shows its content when the value is there and not empty, not="..." when it isn't. On 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/blog/index.html is /blog/.

  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: