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 Widget.Feed ( hFeed )
|
||||||
import Model.Category ( Category, asTag )
|
import Model.Category ( Category, asTag )
|
||||||
|
|
||||||
|
import qualified Data.Text as T
|
||||||
|
|
||||||
getCategoryR :: Category -> Handler Html
|
getCategoryR :: Category -> Handler Html
|
||||||
getCategoryR tag = do
|
getCategoryR tag = do
|
||||||
|
title <- asks $ siteTitle . appSettings
|
||||||
entries <- runDB . select . from $ \(entry `InnerJoin` category) -> do
|
entries <- runDB . select . from $ \(entry `InnerJoin` category) -> do
|
||||||
on $ entry ^. EntryId ==. category ^. EntryCategoryEntryId
|
on $ entry ^. EntryId ==. category ^. EntryCategoryEntryId
|
||||||
where_ $ category ^. EntryCategoryCategory ==. val tag
|
where_ $ category ^. EntryCategoryCategory ==. val tag
|
||||||
return entry
|
return entry
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
setTitle . toHtml . asTag $ tag
|
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
|
getEntriesR kind = do
|
||||||
entries <- runDB $ selectList [EntryKind ==. kind] [Desc EntryPublished]
|
entries <- runDB $ selectList [EntryKind ==. kind] [Desc EntryPublished]
|
||||||
title <- asks $ siteTitle . appSettings
|
title <- asks $ siteTitle . appSettings
|
||||||
|
let myTitle = T.concat [K.pluralise kind, " ~ ", title]
|
||||||
defaultLayout $ do
|
defaultLayout $ do
|
||||||
setTitle . toHtml . K.pluralise $ kind
|
setTitle . toHtml . K.pluralise $ kind
|
||||||
atomLink (FeedKindR kind) $ T.concat [K.pluralise kind, " ~ ", title]
|
FeedKindR kind `atomLink` myTitle
|
||||||
hFeed entries
|
hFeed myTitle entries
|
||||||
|
|
||||||
getEntryR :: a -> EntryId -> Handler Html
|
getEntryR :: a -> EntryId -> Handler Html
|
||||||
getEntryR _ = renderEntry <=< getCached
|
getEntryR _ = renderEntry <=< getCached
|
||||||
|
|
|
@ -4,5 +4,9 @@ module Widget.Feed ( hFeed ) where
|
||||||
import Import
|
import Import
|
||||||
import Widget.Entry ( hEntry )
|
import Widget.Entry ( hEntry )
|
||||||
|
|
||||||
hFeed :: [Entity Entry] -> Widget
|
import qualified Data.Text as T
|
||||||
hFeed entries = $(widgetFile "mf2/h-feed")
|
|
||||||
|
hFeed :: T.Text -> [Entity Entry] -> Widget
|
||||||
|
hFeed name entries = do
|
||||||
|
mroute <- getCurrentRoute
|
||||||
|
$(widgetFile "mf2/h-feed")
|
||||||
|
|
|
@ -2,7 +2,7 @@ body > main
|
||||||
display: flex
|
display: flex
|
||||||
flex-direction: column
|
flex-direction: column
|
||||||
align-items: center
|
align-items: center
|
||||||
> ol.h-feed
|
> div.h-feed
|
||||||
flex: 1
|
flex: 1
|
||||||
margin-bottom: 0
|
margin-bottom: 0
|
||||||
> aside.author
|
> aside.author
|
||||||
|
@ -16,7 +16,7 @@ body > main
|
||||||
body > main
|
body > main
|
||||||
flex-direction: row-reverse
|
flex-direction: row-reverse
|
||||||
align-items: unset
|
align-items: unset
|
||||||
> ol.h-feed
|
> div.h-feed
|
||||||
margin-right: 2em
|
margin-right: 2em
|
||||||
> aside.author
|
> aside.author
|
||||||
margin-bottom: 0
|
margin-bottom: 0
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
<aside .author>^{hCard user}
|
<aside .author>^{hCard user}
|
||||||
^{hFeed entries}
|
^{hFeed title entries}
|
||||||
|
|
|
@ -1,5 +1,2 @@
|
||||||
ol.h-feed
|
div.h-feed > ol > li:not(:last-child)
|
||||||
list-style: none
|
|
||||||
padding-left: 0
|
|
||||||
> li:not(:last-child)
|
|
||||||
margin-bottom: 1em
|
margin-bottom: 1em
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
<ol .h-feed>
|
<div .h-feed>
|
||||||
|
<span .p-name hidden>#{name}
|
||||||
|
$maybe route <- mroute
|
||||||
|
<a .u-url href=@{route} hidden>
|
||||||
|
<ol .list-unstyled>
|
||||||
$forall entry <- entries
|
$forall entry <- entries
|
||||||
<li>^{hEntry entry}
|
<li>^{hEntry entry}
|
||||||
|
|
Loading…
Reference in a new issue