2021-04-06 00:25:37 +03:00
|
|
|
module Site exposing (config)
|
2020-05-24 01:31:56 +03:00
|
|
|
|
2020-10-24 23:02:17 +03:00
|
|
|
import Cloudinary
|
2021-05-05 06:11:08 +03:00
|
|
|
import DataSource exposing (DataSource)
|
2021-04-05 20:02:27 +03:00
|
|
|
import Head
|
2020-10-24 23:02:17 +03:00
|
|
|
import MimeType
|
2021-05-07 20:09:04 +03:00
|
|
|
import Pages.ImagePath exposing (ImagePath)
|
2020-05-24 03:03:28 +03:00
|
|
|
import Pages.Manifest as Manifest
|
2021-04-10 22:37:06 +03:00
|
|
|
import Pages.PagePath as PagePath
|
2021-04-14 04:43:31 +03:00
|
|
|
import SiteConfig exposing (SiteConfig)
|
2020-05-24 03:03:28 +03:00
|
|
|
|
2020-05-24 01:31:56 +03:00
|
|
|
|
2021-04-24 02:22:23 +03:00
|
|
|
config : SiteConfig Data
|
2021-04-13 23:05:33 +03:00
|
|
|
config =
|
2021-04-14 04:43:31 +03:00
|
|
|
\routes ->
|
2021-04-24 02:22:23 +03:00
|
|
|
{ data = data
|
2021-04-18 07:38:30 +03:00
|
|
|
, canonicalUrl = canonicalUrl
|
2021-04-14 04:43:31 +03:00
|
|
|
, manifest = manifest
|
|
|
|
, head = head
|
|
|
|
}
|
2021-04-13 23:05:33 +03:00
|
|
|
|
|
|
|
|
2021-04-24 02:22:23 +03:00
|
|
|
type alias Data =
|
2021-04-05 20:51:06 +03:00
|
|
|
{ siteName : String
|
|
|
|
}
|
2020-09-13 17:19:09 +03:00
|
|
|
|
|
|
|
|
2021-04-24 02:22:23 +03:00
|
|
|
data : DataSource.DataSource Data
|
|
|
|
data =
|
|
|
|
DataSource.map Data
|
2021-04-06 06:58:28 +03:00
|
|
|
--(StaticFile.request "site-name.txt" StaticFile.body)
|
2021-04-20 17:31:19 +03:00
|
|
|
(DataSource.succeed "site-name")
|
2021-04-05 20:02:27 +03:00
|
|
|
|
|
|
|
|
2021-04-24 02:22:23 +03:00
|
|
|
head : Data -> List Head.Tag
|
2021-04-05 20:02:27 +03:00
|
|
|
head static =
|
|
|
|
[ Head.icon [ ( 32, 32 ) ] MimeType.Png (cloudinaryIcon MimeType.Png 32)
|
|
|
|
, Head.icon [ ( 16, 16 ) ] MimeType.Png (cloudinaryIcon MimeType.Png 16)
|
|
|
|
, Head.appleTouchIcon (Just 180) (cloudinaryIcon MimeType.Png 180)
|
|
|
|
, Head.appleTouchIcon (Just 192) (cloudinaryIcon MimeType.Png 192)
|
2021-04-14 05:20:10 +03:00
|
|
|
, Head.sitemapLink "/sitemap.xml"
|
2021-04-05 20:02:27 +03:00
|
|
|
]
|
2020-09-13 18:02:35 +03:00
|
|
|
|
|
|
|
|
2021-04-14 05:20:10 +03:00
|
|
|
canonicalUrl : String
|
|
|
|
canonicalUrl =
|
2020-05-24 01:31:56 +03:00
|
|
|
"https://elm-pages.com"
|
2020-05-24 03:03:28 +03:00
|
|
|
|
|
|
|
|
2021-04-24 02:22:23 +03:00
|
|
|
manifest : Data -> Manifest.Config
|
2021-04-05 20:02:27 +03:00
|
|
|
manifest static =
|
2021-04-23 18:45:05 +03:00
|
|
|
Manifest.init
|
|
|
|
{ name = static.siteName
|
|
|
|
, description = "elm-pages - " ++ tagline
|
|
|
|
, startUrl = PagePath.build []
|
|
|
|
, icons =
|
|
|
|
[ icon webp 192
|
|
|
|
, icon webp 512
|
|
|
|
, icon MimeType.Png 192
|
|
|
|
, icon MimeType.Png 512
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|> Manifest.withShortName "elm-pages"
|
2020-05-24 18:36:40 +03:00
|
|
|
|
|
|
|
|
|
|
|
tagline : String
|
|
|
|
tagline =
|
2021-04-05 20:02:27 +03:00
|
|
|
"A statically typed site generator"
|
2020-10-24 23:02:17 +03:00
|
|
|
|
|
|
|
|
|
|
|
webp : MimeType.MimeImage
|
|
|
|
webp =
|
|
|
|
MimeType.OtherImage "webp"
|
|
|
|
|
|
|
|
|
|
|
|
icon :
|
|
|
|
MimeType.MimeImage
|
|
|
|
-> Int
|
2021-04-10 23:51:39 +03:00
|
|
|
-> Manifest.Icon
|
2020-10-24 23:02:17 +03:00
|
|
|
icon format width =
|
|
|
|
{ src = cloudinaryIcon format width
|
|
|
|
, sizes = [ ( width, width ) ]
|
|
|
|
, mimeType = format |> Just
|
|
|
|
, purposes = [ Manifest.IconPurposeAny, Manifest.IconPurposeMaskable ]
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
cloudinaryIcon :
|
|
|
|
MimeType.MimeImage
|
|
|
|
-> Int
|
2021-04-10 23:51:39 +03:00
|
|
|
-> ImagePath
|
2020-10-24 23:02:17 +03:00
|
|
|
cloudinaryIcon mimeType width =
|
|
|
|
Cloudinary.urlSquare "v1603234028/elm-pages/elm-pages-icon" (Just mimeType) width
|