Add category pages to the sitemap
This commit is contained in:
parent
c184136f8a
commit
9d0d6ba249
1 changed files with 10 additions and 0 deletions
|
@ -31,6 +31,7 @@ getRobotsR = robots SitemapR
|
||||||
|
|
||||||
getSitemapR :: Handler TypedContent
|
getSitemapR :: Handler TypedContent
|
||||||
getSitemapR = do
|
getSitemapR = do
|
||||||
|
categories <- runDB $ selectList [] [Asc CategoryTag]
|
||||||
entries <- runDB $ selectList [] [Desc EntryPublished]
|
entries <- runDB $ selectList [] [Desc EntryPublished]
|
||||||
sitemap $ do
|
sitemap $ do
|
||||||
yield SitemapUrl
|
yield SitemapUrl
|
||||||
|
@ -39,9 +40,18 @@ getSitemapR = do
|
||||||
, sitemapChangeFreq = Just Daily
|
, sitemapChangeFreq = Just Daily
|
||||||
, sitemapPriority = Nothing
|
, sitemapPriority = Nothing
|
||||||
}
|
}
|
||||||
|
yieldMany $ categoryToSitemapUrl <$> categories
|
||||||
yieldMany $ kindToSitemapUrl <$> allEntryKinds
|
yieldMany $ kindToSitemapUrl <$> allEntryKinds
|
||||||
yieldMany $ entryToSitemapUrl <$> entries
|
yieldMany $ entryToSitemapUrl <$> entries
|
||||||
|
|
||||||
|
categoryToSitemapUrl :: Entity Category -> SitemapUrl (Route App)
|
||||||
|
categoryToSitemapUrl (Entity catId cat) = SitemapUrl
|
||||||
|
{ sitemapLoc = CategoryR $ categoryTag cat
|
||||||
|
, sitemapLastMod = Nothing
|
||||||
|
, sitemapChangeFreq = Nothing
|
||||||
|
, sitemapPriority = Nothing
|
||||||
|
}
|
||||||
|
|
||||||
kindToSitemapUrl :: EntryKind -> SitemapUrl (Route App)
|
kindToSitemapUrl :: EntryKind -> SitemapUrl (Route App)
|
||||||
kindToSitemapUrl kind = SitemapUrl
|
kindToSitemapUrl kind = SitemapUrl
|
||||||
{ sitemapLoc = EntriesR kind
|
{ sitemapLoc = EntriesR kind
|
||||||
|
|
Loading…
Reference in a new issue