about summary refs log tree commit diff
path: root/web/blog
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-09-13T12·14+0300
committertazjin <tazjin@tvl.su>2022-09-13T14·29+0000
commit7fd7a4465b4357654af51bf7914e438932141f31 (patch)
treec891d7a5da2e1c29a25a53d1e336480327c6b0d8 /web/blog
parente726df8dc54e88edbbd42b215e0ee3ee6154a839 (diff)
feat(web/blog): add ability to specify post author r/4835
Anyone is free to pen a post for tvl.fyi if they want, so being able
to attribute the author might be useful.

This wasn't originally a feature because I wrote //web/blog only for
tazj.in initially.

Change-Id: Ibc50b53f92113a82a53ce40bb5defa18e926cc10
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6560
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: grfn <grfn@gws.fyi>
Diffstat (limited to 'web/blog')
-rw-r--r--web/blog/default.nix3
-rw-r--r--web/blog/fragments.nix1
2 files changed, 4 insertions, 0 deletions
diff --git a/web/blog/default.nix b/web/blog/default.nix
index f55c33a63a54..66d7759deb7b 100644
--- a/web/blog/default.nix
+++ b/web/blog/default.nix
@@ -24,6 +24,9 @@ let
     # Path to the Markdown file containing the post content.
     content = path;
 
+    # Optional name of the author to display.
+    author = option string;
+
     # Should this post be included in the index? (defaults to true)
     listed = option bool;
 
diff --git a/web/blog/fragments.nix b/web/blog/fragments.nix
index 19d62fa4744d..8126278270dc 100644
--- a/web/blog/fragments.nix
+++ b/web/blog/fragments.nix
@@ -73,6 +73,7 @@ let
       then ''date --date="@${toString post.updated}" '+ (updated %Y-%m-%d)' >> $out''
       else ""
     }
+    ${if post ? author then "echo ' by ${post.author}' >> $out" else ""}
     echo '</aside>' >> $out
 
     ${