rib-0.12.0.0: Static site generator based on Shake

Safe HaskellNone
LanguageHaskell2010

Rib.Route

Contents

Description

Type-safe routes for static sites.

Synopsis

Defining routes

class IsRoute (r :: Type -> Type) where Source #

A route is a GADT which represents the individual routes in a static site.

r represents the data used to render that particular route.

Methods

routeFile :: MonadThrow m => r a -> m FilePath Source #

Return the filepath (relative to ribInputDir) where the generated content for this route should be written.

Rendering routes

routeUrl :: IsRoute r => r a -> Text Source #

The absolute URL to this route (relative to site root)

routeUrlRel :: IsRoute r => r a -> Text Source #

The relative URL to this route

Writing routes

writeRoute :: (IsRoute r, ToString s) => r a -> s -> Action () Source #

Write the content s to the file corresponding to the given route.

This is similar to writeFileCached, but takes a route instead of a filepath as its argument.