Home: only show News if post is from the last ~6 months

This commit is contained in:
Jens Petersen 2021-03-26 12:04:38 +08:00
parent ffe944ae74
commit 070cbc6bf2
2 changed files with 4 additions and 4 deletions

View File

@ -35,8 +35,8 @@ getHomeR = track "Handler.Snapshots.getAllSnapshotsR" $ do
let latestNightly = groupUp now' nightly let latestNightly = groupUp now' nightly
latestLtsNameWithHoogle <- getLatestLtsNameWithHoogle latestLtsNameWithHoogle <- getLatestLtsNameWithHoogle
latestLtsByGhc <- getLatestLtsByGhc latestLtsByGhc <- getLatestLtsByGhc
let sixMonthsAgo = addUTCTime (-180 * nominalDay) now'
mrecentBlog <- headMay <$> getPosts mrecentBlog <- headMay . filter (\p -> postTime p > sixMonthsAgo) <$> getPosts
defaultLayout $ do defaultLayout $ do
setTitle "Stackage Server" setTitle "Stackage Server"

View File

@ -20,8 +20,8 @@
<li>Stackage is a community project: <a href="https://github.com/fpco/stackage/blob/master/MAINTAINERS.md#adding-a-package"><b>how to add packages to Stackage</b></a> <li>Stackage is a community project: <a href="https://github.com/fpco/stackage/blob/master/MAINTAINERS.md#adding-a-package"><b>how to add packages to Stackage</b></a>
<li><a href="https://haskellstack.org">stack</a> makes using Stackage easy <li><a href="https://haskellstack.org">stack</a> makes using Stackage easy
<div .span6> <div .span6>
<h3>News</h3> $maybe post <- mrecentBlog
$maybe post <- mrecentBlog <h3>News</h3>
<p> <p>
<a href=@{BlogPostR (postYear post) (postMonth post) (postSlug post)}>#{postTitle post}</a>, <a href=@{BlogPostR (postYear post) (postMonth post) (postSlug post)}>#{postTitle post}</a>,
<abbr title=#{show $ postTime post}>#{dateDiff now' (utctDay $ postTime post)}</abbr> <abbr title=#{show $ postTime post}>#{dateDiff now' (utctDay $ postTime post)}</abbr>