Properly set p-name on h-feeds, rather than trying to infer it and getting awful names
This commit is contained in:
parent
46c393552a
commit
db32b02811
7 changed files with 25 additions and 16 deletions
|
@ -8,12 +8,15 @@ import Database.Esqueleto
|
|||
import Widget.Feed ( hFeed )
|
||||
import Model.Category ( Category, asTag )
|
||||
|
||||
import qualified Data.Text as T
|
||||
|
||||
getCategoryR :: Category -> Handler Html
|
||||
getCategoryR tag = do
|
||||
title <- asks $ siteTitle . appSettings
|
||||
entries <- runDB . select . from $ \(entry `InnerJoin` category) -> do
|
||||
on $ entry ^. EntryId ==. category ^. EntryCategoryEntryId
|
||||
where_ $ category ^. EntryCategoryCategory ==. val tag
|
||||
return entry
|
||||
defaultLayout $ do
|
||||
setTitle . toHtml . asTag $ tag
|
||||
hFeed entries
|
||||
T.concat [asTag tag, " ~ ", title] `hFeed` entries
|
||||
|
|
|
@ -20,10 +20,11 @@ getEntriesR :: K.EntryKind -> Handler Html
|
|||
getEntriesR kind = do
|
||||
entries <- runDB $ selectList [EntryKind ==. kind] [Desc EntryPublished]
|
||||
title <- asks $ siteTitle . appSettings
|
||||
let myTitle = T.concat [K.pluralise kind, " ~ ", title]
|
||||
defaultLayout $ do
|
||||
setTitle . toHtml . K.pluralise $ kind
|
||||
atomLink (FeedKindR kind) $ T.concat [K.pluralise kind, " ~ ", title]
|
||||
hFeed entries
|
||||
FeedKindR kind `atomLink` myTitle
|
||||
hFeed myTitle entries
|
||||
|
||||
getEntryR :: a -> EntryId -> Handler Html
|
||||
getEntryR _ = renderEntry <=< getCached
|
||||
|
|
|
@ -4,5 +4,9 @@ module Widget.Feed ( hFeed ) where
|
|||
import Import
|
||||
import Widget.Entry ( hEntry )
|
||||
|
||||
hFeed :: [Entity Entry] -> Widget
|
||||
hFeed entries = $(widgetFile "mf2/h-feed")
|
||||
import qualified Data.Text as T
|
||||
|
||||
hFeed :: T.Text -> [Entity Entry] -> Widget
|
||||
hFeed name entries = do
|
||||
mroute <- getCurrentRoute
|
||||
$(widgetFile "mf2/h-feed")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue