aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules/blog/module.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/modules/blog/module.rs b/src/modules/blog/module.rs
index 9d00eea..e6fcd06 100644
--- a/src/modules/blog/module.rs
+++ b/src/modules/blog/module.rs
@@ -320,10 +320,21 @@ fn construct_header(
};
}
+ macro_rules! any_is_some {
+ ($($getter:ident),*) => {
+ $(post.$getter().is_some() ||)* false
+ };
+ }
+
Ok((
format!(
- "# {}\n\n{}{}{}{}",
+ "# {}\n{}{}{}{}{}",
post.name().clone().unwrap_or_else(|| name.to_string()),
+ if any_is_some![author, created, last_modified, description] {
+ "\n"
+ } else {
+ ""
+ },
field!(author, "Author: {}\n"),
field!(created, "Created: {}\n"),
field!(last_modified, "Last Modified: {}\n"),