Add basic support for h-entry categories, which are actually more like tags than categories really
This commit is contained in:
parent
dfafe33e06
commit
474ed3cf28
5 changed files with 35 additions and 0 deletions
22
src/Handler/Categories.hs
Normal file
22
src/Handler/Categories.hs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{-# LANGUAGE NoImplicitPrelude #-}
|
||||
{-# LANGUAGE OverloadedStrings #-}
|
||||
module Handler.Categories where
|
||||
|
||||
import Import hiding ( on, (==.) )
|
||||
|
||||
import Database.Esqueleto
|
||||
import Web.Slug ( Slug, unSlug )
|
||||
import Widget.Feed ( hFeed )
|
||||
|
||||
import qualified Data.Text as T
|
||||
|
||||
getCategoryR :: Slug -> Handler Html
|
||||
getCategoryR tag = do
|
||||
entries <- runDB . select . from $ \(category `InnerJoin` ec `InnerJoin` entry) -> do
|
||||
on $ entry ^. EntryId ==. ec ^. EntryCategoryEntryId
|
||||
on $ category ^. CategoryId ==. ec ^. EntryCategoryCategoryId
|
||||
where_ $ category ^. CategoryTag ==. val tag
|
||||
return entry
|
||||
defaultLayout $ do
|
||||
setTitle . toHtml . T.cons '#' . unSlug $ tag
|
||||
hFeed entries
|
||||
Loading…
Add table
Add a link
Reference in a new issue