Hide draft posts from rss feed and sitemap.

This commit is contained in:
Dillon Kearns 2020-01-26 08:31:30 -08:00
parent 920694a024
commit 5522ca068d
2 changed files with 22 additions and 9 deletions

View File

@ -58,15 +58,19 @@ metadataToRssItem :
metadataToRssItem page = metadataToRssItem page =
case page.frontmatter of case page.frontmatter of
Article article -> Article article ->
Just if article.draft then
{ title = article.title Nothing
, description = article.description
, url = PagePath.toString page.path else
, categories = [] Just
, author = article.author.name { title = article.title
, pubDate = Rss.Date article.published , description = article.description
, content = Nothing , url = PagePath.toString page.path
} , categories = []
, author = article.author.name
, pubDate = Rss.Date article.published
, content = Nothing
}
_ -> _ ->
Nothing Nothing

View File

@ -24,6 +24,15 @@ build config siteMetadata =
, content = , content =
Sitemap.build config Sitemap.build config
(siteMetadata (siteMetadata
|> List.filter
(\page ->
case page.frontmatter of
Article articleData ->
not articleData.draft
_ ->
True
)
|> List.map |> List.map
(\page -> (\page ->
{ path = PagePath.toString page.path, lastMod = Nothing } { path = PagePath.toString page.path, lastMod = Nothing }