Routing

The layout of pages/ is the routing table. There is no router to configure and no route file to keep in sync.

Files to URLs

FileURL
pages/index.azox/
pages/about.azox/about
pages/blog/index.azox/blog
pages/blog/first-post.azox/blog/first-post
pages/docs/guide/setup.azox/docs/guide/setup

A file named index takes the name of its directory rather than adding a segment, so blog/index.azox is /blog and not /blog/index. Directories can nest as deeply as you like.

What the build emits

Each route becomes a directory containing an index.html. That is what makes clean URLs work everywhere: serving index.html for a directory is universal behaviour, so no rewrite rules are needed on any host.

.azox/build/
index.html                    /
page.client.js
azox-runtime.js               shared by every page

about/
├── index.html                /about
└── page.client.js

blog/
├── index.html                /blog
├── page.client.js
└── first-post/
    ├── index.html            /blog/first-post
    └── page.client.js

The runtime is copied once, at the build root, and every page imports it through a relative path matching its own depth.

Linking between pages

Plain <a> tags with absolute paths. There is no client-side router in this version, so each navigation is a real page load — which also means each page arrives as server-rendered HTML.

links
<a href="/">Home</a>
<a href="/about">About</a>
<a href="/blog/first-post">First post</a>

Building one page

By file name or by URL, whichever reads better:

terminal
azox compile --page=blog/first-post
azox compile --page=/blog/first-post

Ignored files

Anything that is not a .azox file is skipped, as are dot-directories. Only pages become routes.

Dynamic routes such as [slug].azox are not supported yet. Every route is a file that exists at build time. See limitations.

Next