mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-28 06:05:31 +03:00
Add page with route params to skeleton example.
This commit is contained in:
parent
020e870883
commit
b7f6c6cff8
77
examples/hello/app/Page/Blog/Slug_.elm
Normal file
77
examples/hello/app/Page/Blog/Slug_.elm
Normal 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_"
|
Loading…
Reference in New Issue
Block a user