environment variables for port and filtering posts
This commit is contained in:
@ -37,7 +37,7 @@ pub async fn render_post_list(tag: Option<Path<String>>) -> Result<PostListTempl
|
||||
posts.push(post);
|
||||
}
|
||||
|
||||
let posts = match &tag {
|
||||
let mut posts = match &tag {
|
||||
Some(tag) => posts
|
||||
.into_iter()
|
||||
.filter(|post| {
|
||||
@ -52,6 +52,16 @@ pub async fn render_post_list(tag: Option<Path<String>>) -> Result<PostListTempl
|
||||
None => posts,
|
||||
};
|
||||
|
||||
if std::env::var("TARGET")
|
||||
.unwrap_or_else(|_| "DEV".to_owned())
|
||||
.eq("PROD")
|
||||
{
|
||||
posts = posts
|
||||
.into_iter()
|
||||
.filter(|post| !post.slug.starts_with("dev"))
|
||||
.collect()
|
||||
}
|
||||
|
||||
Ok(PostListTemplate {
|
||||
title: "Posts".to_owned(),
|
||||
posts,
|
||||
|
Reference in New Issue
Block a user