Once a target is compiled, the user usually wants to save it to the disk.
This is where the
Routes type comes in; it determines where a certain
target should be written.
Suppose we have an item
foo/bar.markdown. We can render this to
route "foo/bar.markdown" (setExtension ".html")
If we do not want to change the extension, we can use
idRoute, the simplest
route "foo/bar.markdown" idRoute
That will route
Note that the extension says nothing about the content! If you set the
.html, it is your own responsibility to ensure that the
content is indeed HTML.
Finally, some special cases:
- If there is no route for an item, this item will not be routed, so it will not appear in your site directory.
- If an item matches multiple routes, the first rule will be chosen.
A route that uses the identifier as filepath. For example, the target with
foo/bar will be written to the file
Set (or replace) the extension of a route.
runRoute (setExtension "html") "foo/bar"
runRoute (setExtension "html") "posts/the-art-of-trolling.markdown"
Modify a route: apply the route if the identifier matches the given pattern, fail otherwise.