Pages.Manifest

Represents the configuration of a web manifest file.

You pass your Pages.Manifest.Config record into the Pages.application function (from your generated Pages.elm file).

import Pages.Manifest as Manifest
import Pages.Manifest.Category

manifest : Manifest.Config
manifest =
    Manifest.init
        { name = static.siteName
        , description = "elm-pages - " ++ tagline
        , startUrl = Route.Index {} |> Route.toPath
        , icons =
            [ icon webp 192
            , icon webp 512
            , icon MimeType.Png 192
            , icon MimeType.Png 512
            ]
        }
        |> Manifest.withShortName "elm-pages"
type alias Config =
{ backgroundColor : Maybe Color
, categories : List Category
, displayMode : DisplayMode
, orientation : Orientation
, description : String
, iarcRatingId : Maybe String
, name : String
, themeColor : Maybe Color
, startUrl : Path
, shortName : Maybe String
, icons : List Icon
, lang : LanguageTag
}

Represents a web app manifest file (see above for how to use it).

type alias Icon =
{ src : Url
, sizes : List ( Int, Int )
, mimeType : Maybe MimeImage
, purposes : List IconPurpose
}

Builder options

{ description : String
, name : String
, startUrl : Path
, icons : List Icon
}
-> Config

Setup a minimal Manifest.Config. You can then use the with... builder functions to set additional options.

Config options

= Fullscreen
| Standalone
| MinimalUi
| Browser
= Any
| Natural
| Landscape
| LandscapePrimary
| LandscapeSecondary
| Portrait
| PortraitPrimary
| PortraitSecondary
= IconPurposeMonochrome
| IconPurposeMaskable
| IconPurposeAny

Generating a Manifest.json

generator : String -> DataSource Config -> ApiRoute Response

A generator for Api.elm to include a manifest.json.

Functions for use by the generated code (Pages.elm)

toJson : String -> Config -> Value

Feel free to use this, but in 99% of cases you won't need it. The generated code will run this for you to generate your manifest.json file automatically!