Add page with route params to skeleton example.

This commit is contained in:
Dillon Kearns 2022-03-05 08:56:07 -08:00
parent 020e870883
commit b7f6c6cff8

View File

@ -0,0 +1,77 @@
module Page.Blog.Slug_ exposing (Data, Model, Msg, page)
import DataSource exposing (DataSource)
import Head
import Head.Seo as Seo
import Page exposing (Page, StaticPayload)
import Pages.PageUrl exposing (PageUrl)
import Pages.Url
import Shared
import View exposing (View)
type alias Model =
{}
type alias Msg =
()
type alias RouteParams =
{ slug : String }
page : Page RouteParams Data
page =
Page.preRender
{ head = head
, pages = pages
, data = data
}
|> Page.buildNoState { view = view }
pages : DataSource (List RouteParams)
pages =
DataSource.succeed []
type alias Data =
{ something : String
}
data : RouteParams -> DataSource Data
data routeParams =
DataSource.map Data
(DataSource.succeed "Hi")
head :
StaticPayload Data RouteParams
-> List Head.Tag
head static =
Seo.summary
{ canonicalUrlOverride = Nothing
, siteName = "elm-pages"
, image =
{ url = Pages.Url.external "TODO"
, alt = "elm-pages logo"
, dimensions = Nothing
, mimeType = Nothing
}
, description = "TODO"
, locale = Nothing
, title = "TODO title" -- metadata.title -- TODO
}
|> Seo.website
view :
Maybe PageUrl
-> Shared.Model
-> StaticPayload Data RouteParams
-> View Msg
view maybeUrl sharedModel static =
View.placeholder "Blog.Slug_"