dillonkearns/elm-pages/4.0.0

NOTE: the latest version is 12.3.0

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
import Pages.Manifest as Manifest
import Pages.Manifest.Category
import Pages.PagePath as PagePath exposing (PagePath)
import Palette


manifest : Manifest.Config Pages.PathKey
manifest =
    { backgroundColor = Just Color.white
    , categories = [ Pages.Manifest.Category.education ]
    , displayMode = Manifest.Standalone
    , orientation = Manifest.Portrait
    , description = "elm-pages - A statically typed site generator."
    , iarcRatingId = Nothing
    , name = "elm-pages docs"
    , themeColor = Just Color.white
    , startUrl = Pages.pages.index
    , shortName = Just "elm-pages"
    , sourceIcon = Pages.images.icon
    }


main : Pages.Program Model Msg Metadata (List (Element Msg))
main =
    Pages.application
        { init = init
        , view = view
        , update = update
        , subscriptions = subscriptions
        , documents = [ markdownDocument ]
        , head = head
        , manifest = manifest
        , canonicalSiteUrl = canonicalSiteUrl
        }
type alias Config pathKey =
{ backgroundColor : Maybe Color
, categories : List Category
, displayMode : DisplayMode
, orientation : Orientation
, description : String
, iarcRatingId : Maybe String
, name : String
, themeColor : Maybe Color
, startUrl : PagePath pathKey
, shortName : Maybe String
, sourceIcon : ImagePath pathKey
}

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

The sourceIcon is used to automatically generate all of the Favicons and manifest icons of the appropriate sizes (512x512, etc) for Android, iOS, etc. So you just point at a single image asset and you will have optimized images following all the best practices!

Type-safe static paths

The pathKey in this type is used to ensure that you are using known static resources for any internal image or page paths.

  • The startUrl is a type-safe PagePath, ensuring that any internal links are present (not broken links).
  • The sourceIcon is a type-safe ImagePath, ensuring that any internal images are present (not broken images).

Config options

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

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

toJson : Config pathKey -> 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!