diff --git a/assets/elm_logo.svg b/assets/elm_logo.svg new file mode 100644 index 00000000..7d669f0a --- /dev/null +++ b/assets/elm_logo.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/backend/Main.hs b/src/backend/Main.hs index e10eb8c9..39037d76 100644 --- a/src/backend/Main.hs +++ b/src/backend/Main.hs @@ -187,7 +187,7 @@ serveVersion memory author project maybeVersion info = Nothing -> S.pass - Just (Memory.Summary versions _ _) -> + Just (Memory.Summary versions maybeDetails _) -> case verifyVersion maybeVersion versions of Nothing -> S.pass @@ -195,7 +195,8 @@ serveVersion memory author project maybeVersion info = Just version -> case info of Readme -> - ServeFile.version name version Nothing + ServeFile.version name version Nothing $ + maybe Nothing (Just . fst) maybeDetails Module asset -> serveVersionHelp name version asset @@ -220,7 +221,7 @@ serveVersionHelp name version asset = _ -> case Module.fromHyphenPath asset of Just moduleName -> - ServeFile.version name version (Just moduleName) + ServeFile.version name version (Just moduleName) Nothing Nothing -> S.pass diff --git a/src/backend/ServeFile.hs b/src/backend/ServeFile.hs index 82225444..8a8e47ec 100644 --- a/src/backend/ServeFile.hs +++ b/src/backend/ServeFile.hs @@ -28,7 +28,7 @@ import qualified Elm.Package as Pkg misc :: B.Builder -> Snap () misc title = - makeHtml title mempty + makeHtml title mempty (makeOgpMetadata title Nothing) @@ -37,15 +37,18 @@ misc title = project :: Pkg.Name -> Snap () project pkg = - makeHtml (B.stringUtf8 (Pkg.toString pkg)) mempty + let + title = (B.stringUtf8 (Pkg.toString pkg)) + in + makeHtml title mempty (makeOgpMetadata title Nothing) -- VERSION -version :: Pkg.Name -> Pkg.Version -> Maybe Module.Raw -> Snap () -version pkg@(Pkg.Name _ prjct) vsn maybeName = +version :: Pkg.Name -> Pkg.Version -> Maybe Module.Raw -> Maybe Text.Text -> Snap () +version pkg@(Pkg.Name _ prjct) vsn maybeName maybeDescription = let versionString = Pkg.versionToString vsn @@ -56,8 +59,14 @@ version pkg@(Pkg.Name _ prjct) vsn maybeName = title = maybe "" (++" - ") maybeStringName ++ Text.unpack prjct ++ " " ++ versionString + + ogpTitle = + maybe "" (++" - ") maybeStringName + ++ Pkg.toString pkg ++ " " ++ versionString + in makeHtml (B.stringUtf8 title) (makeCanonicalLink pkg maybeName) + (makeOgpMetadata (B.stringUtf8 ogpTitle) maybeDescription) @@ -106,19 +115,35 @@ renames = (,) +-- OGP METADATA + +makeOgpMetadata :: B.Builder -> Maybe Text.Text -> B.Builder +makeOgpMetadata title maybeDescription = + let + description = + maybe "" (B.stringUtf8 . Text.unpack . \d -> + [r||] + ) maybeDescription + in + [r| + + + |] + <> description + -- SKELETON -makeHtml :: B.Builder -> B.Builder -> Snap () -makeHtml title canonicalLink = +makeHtml :: B.Builder -> B.Builder -> B.Builder -> Snap () +makeHtml title canonicalLink ogpMetadata = writeBuilder $ [r| - |] <> title <> [r||] <> canonicalLink <> [r| + |] <> title <> [r||] <> canonicalLink <> ogpMetadata <> [r|