Add permalinks to h-entries
This commit is contained in:
parent
9679234062
commit
7cebf92356
3 changed files with 8 additions and 7 deletions
|
@ -7,7 +7,7 @@ import Import
|
|||
import Web.Slug ( Slug )
|
||||
|
||||
import qualified Entry.Kind as K
|
||||
import Widget.Entry ( hEntry )
|
||||
import Widget.Entry ( entryR, hEntry )
|
||||
import Widget.Feed ( hFeed )
|
||||
|
||||
getEntriesR :: K.EntryKind -> Handler Html
|
||||
|
@ -15,9 +15,6 @@ getEntriesR kind = do
|
|||
entries <- runDB $ selectList [EntryKind ==. kind] [Desc EntryPublished]
|
||||
defaultLayout $(widgetFile "entries")
|
||||
|
||||
entryR :: Entity Entry -> Route App
|
||||
entryR (Entity entryId entry) = EntryR (entryKind entry) entryId (entrySlug entry)
|
||||
|
||||
checkMatching :: K.EntryKind -> Slug -> Entry -> Bool
|
||||
checkMatching kind slug entry = (kind == entryKind entry) && (slug == entrySlug entry)
|
||||
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{-# LANGUAGE NoImplicitPrelude #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
module Widget.Entry ( hEntry ) where
|
||||
module Widget.Entry ( entryR, hEntry ) where
|
||||
|
||||
import Import
|
||||
|
||||
entryR :: Entity Entry -> Route App
|
||||
entryR (Entity entryId entry) = EntryR (entryKind entry) entryId (entrySlug entry)
|
||||
|
||||
hEntry :: Entity Entry -> Widget
|
||||
hEntry (Entity entryId entry) = do
|
||||
maybeAuthor <- handlerToWidget . runDB . get . entryAuthorId $ entry
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<article .h-entry>
|
||||
<h1 .p-name>#{entryName entry}
|
||||
<a .u-url href="@{entryR (Entity entryId entry)}">permalink
|
||||
<p>
|
||||
Published
|
||||
published
|
||||
$maybe author <- maybeAuthor
|
||||
\ by
|
||||
<a .p-author.h-card href=@{HomeR}>
|
||||
|
|
Loading…
Reference in a new issue