Actually set the 'author' meta correctly in the page head

This commit is contained in:
Danielle McLean 2017-10-05 23:09:44 +11:00
parent edd82eff55
commit e141fb4666
Signed by: 00dani
GPG key ID: 5A5D2D1AFF12EEC5
2 changed files with 8 additions and 4 deletions

View file

@ -1,7 +1,7 @@
{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeFamilies #-}
module Handler.Home where module Handler.Home where
@ -11,9 +11,15 @@ import Widget.Hcard (hcard)
getHomeR :: Handler Html getHomeR :: Handler Html
getHomeR = do getHomeR = do
user <- runDB . getBy404 $ UniqueUsername "dani" user <- runDB . getBy404 $ UniqueUsername "dani"
let name = userFullName . entityVal $ user
maybeTitle <- asks $ appTitle . appSettings maybeTitle <- asks $ appTitle . appSettings
defaultLayout $ do defaultLayout $ do
case maybeTitle of case maybeTitle of
Just title -> setTitle $ toHtml title Just title -> setTitle $ toHtml title
Nothing -> return () Nothing -> return ()
toWidgetHead
[hamlet|
<meta name="author" content=#{name}>
<link rel="author" href=@{HomeR}>
|]
$(widgetFile "home") $(widgetFile "home")

View file

@ -3,11 +3,9 @@ $doctype 5
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="generator" content="#{packageName package} #{packageVersion package}">
<title>#{pageTitle pc} <title>#{pageTitle pc}
<meta name="description" content="">
<meta name="author" content="">
<meta name="generator" content="#{packageName package} #{packageVersion package}">
$maybe route <- mcurrentRoute $maybe route <- mcurrentRoute
<link rel="canonical" href=@{route}> <link rel="canonical" href=@{route}>