Shpadoinkle-disembodied-0.0.0.2: Shpadoinkle as a static site.

Safe HaskellNone
LanguageHaskell2010

Shpadoinkle.Disembodied

Contents

Description

Static sites are the opposite of headless applications, they are disembodied. Shpadoinkle Disembodied is a static site generator for Shpadoinkle applications.

Synopsis

Site Reification

data Site where Source #

The reification of a static site based on Servant routes. Site takes a context ctx which is universal for the static site. This is useful for storing commonly used valus like the site name, site url, copyright date, ect.

Constructors

SPath

A path segment in the URI

Fields

  • :: String

    The current URI path segment

  • -> Site

    The site to be rendered at the path

  • -> Site
     
SIndex

Html to be rendered as index.html

Fields

  • :: Html m a

    Given a context, how can we render a page?

  • -> Site
     
SCapture

Capture is the one Servant combinator that can be meaningful in static site generation, and only if we can generate all possible instances.

Fields

SChoice :: Site -> Site -> Site

Branch the site at a given point in generation.

Class

class Disembodied a where Source #

Type class induction for building the site out of a specification

Associated Types

type SiteSpec a :: Type Source #

A type family to represent the relationship between a Servant API and the Html views to render.

type SPA m = "about" :> Html m ()
        :<|> Html m ()

site :: SiteSpec () (SPA m)
site = const (h1_ [ text "about" ])
  :<|> const (h1_ [ text "home" ])

Methods

buildSite :: SiteSpec a -> Site Source #

Construct the site structure out of the associated API

Instances
Disembodied (f (HTML ': ([] :: [Type])) (Html m a)) Source # 
Instance details

Defined in Shpadoinkle.Disembodied

Associated Types

type SiteSpec (f (HTML ': []) (Html m a)) :: Type Source #

Methods

buildSite :: SiteSpec (f (HTML ': []) (Html m a)) -> Site Source #

Disembodied (View m a) Source # 
Instance details

Defined in Shpadoinkle.Disembodied

Associated Types

type SiteSpec (View m a) :: Type Source #

Methods

buildSite :: SiteSpec (View m a) -> Site Source #

(Disembodied x, Disembodied y) => Disembodied (x :<|> y) Source # 
Instance details

Defined in Shpadoinkle.Disembodied

Associated Types

type SiteSpec (x :<|> y) :: Type Source #

Methods

buildSite :: SiteSpec (x :<|> y) -> Site Source #

Disembodied sub => Disembodied (QueryParam sym x :> sub) Source # 
Instance details

Defined in Shpadoinkle.Disembodied

Associated Types

type SiteSpec (QueryParam sym x :> sub) :: Type Source #

Methods

buildSite :: SiteSpec (QueryParam sym x :> sub) -> Site Source #

Disembodied sub => Disembodied (QueryParam' ms sym x :> sub) Source # 
Instance details

Defined in Shpadoinkle.Disembodied

Associated Types

type SiteSpec (QueryParam' ms sym x :> sub) :: Type Source #

Methods

buildSite :: SiteSpec (QueryParam' ms sym x :> sub) -> Site Source #

Disembodied sub => Disembodied (QueryParams sym x :> sub) Source # 
Instance details

Defined in Shpadoinkle.Disembodied

Associated Types

type SiteSpec (QueryParams sym x :> sub) :: Type Source #

Methods

buildSite :: SiteSpec (QueryParams sym x :> sub) -> Site Source #

Disembodied sub => Disembodied (QueryFlag sym :> sub) Source # 
Instance details

Defined in Shpadoinkle.Disembodied

Associated Types

type SiteSpec (QueryFlag sym :> sub) :: Type Source #

Methods

buildSite :: SiteSpec (QueryFlag sym :> sub) -> Site Source #

(Disembodied sub, FromHttpApiData x, ToHttpApiData x, Bounded x, Enum x) => Disembodied (Capture sym x :> sub) Source # 
Instance details

Defined in Shpadoinkle.Disembodied

Associated Types

type SiteSpec (Capture sym x :> sub) :: Type Source #

Methods

buildSite :: SiteSpec (Capture sym x :> sub) -> Site Source #

(Disembodied sub, KnownSymbol path) => Disembodied (path :> sub) Source # 
Instance details

Defined in Shpadoinkle.Disembodied

Associated Types

type SiteSpec (path :> sub) :: Type Source #

Methods

buildSite :: SiteSpec (path :> sub) -> Site Source #

Write Files

writeSite Source #

Arguments

:: Disembodied layout 
=> FilePath

Out path

-> SiteSpec layout

Specification for the pages of the site relative to a Servant API.

-> IO () 

Actually write the site to disk. Branches are written in parallel.

writeSiteMap Source #

Arguments

:: Disembodied layout 
=> String

Base url

-> FilePath

Out path

-> SiteSpec layout

Specification for the pages of the site relative to a Servant API.

-> IO () 

Generate a sitemap.xml