Put the <link>s for PGP keys into the page header instead of the h-card itself, since it's invalid HTML to have <link> in the body

This commit is contained in:
Danielle McLean 2017-10-14 15:35:16 +11:00
parent 9d0d6ba249
commit 44288b419c
Signed by: 00dani
GPG key ID: 5A5D2D1AFF12EEC5
2 changed files with 6 additions and 2 deletions

View file

@ -1,5 +1,6 @@
{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Widget.Card ( hCard ) where module Widget.Card ( hCard ) where
@ -31,4 +32,8 @@ hCard (Entity userId user) = do
E.orderBy [E.asc $ site ^. SiteName] E.orderBy [E.asc $ site ^. SiteName]
return (site, profile) return (site, profile)
pgpKeys <- handlerToWidget . runDB $ map entityVal <$> selectList [PgpKeyUserId ==. userId] [] pgpKeys <- handlerToWidget . runDB $ map entityVal <$> selectList [PgpKeyUserId ==. userId] []
toWidgetHead [hamlet|
$forall key <- pgpKeys
<link rel="pgpkey" type="application/pgp-keys" href=@{routeFromPgp key}>
|]
$(widgetFile "mf2/h-card") $(widgetFile "mf2/h-card")

View file

@ -7,10 +7,9 @@
<div .card-body> <div .card-body>
<h4 .card-title.p-name>#{userFullName user} <h4 .card-title.p-name>#{userFullName user}
$forall key <- pgpKeys $forall key <- pgpKeys
<a .card-subtitle.u-key href=@{routeFromPgp key}> <a .card-subtitle.u-key type="application/pgp-keys" href=@{routeFromPgp key}>
<i .fa.fa-key> <i .fa.fa-key>
#{prettyPgp key} #{prettyPgp key}
<link rel="pgpkey" type="application/pgp-keys" href=@{routeFromPgp key}>
<p .card-text.p-note .text-muted>#{userNote user} <p .card-text.p-note .text-muted>#{userNote user}
<ul .profiles> <ul .profiles>