about summary refs log tree commit diff
path: root/users/wpcarro/website/blog
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2021-12-30T19·34-0400
committerclbot <clbot@tvl.fyi>2022-01-08T05·33+0000
commitca6be786a18aedcb3d5a649a2b00973c3e38bc65 (patch)
treee0bec1ecb076f8dc279a4cdd223d5f7a2a758398 /users/wpcarro/website/blog
parent44f20ea8108c82eef254c5e031f59bbc21cf2992 (diff)
chore(wpcarro/website): Templatize website r/3538
Preferring billandhiscomputer.com in lieu of wpcarro.dev. wpcarro is a bit of a
tough username for others to remember and for me to say out-loud (it usually
involves me spelling it and explaining to others why Carroll is missing
2x-Ls). I think it's time for a change.

During the transition, I don't want to deal with stale links to
https://wpcarro.dev, so I'm templatizing more of my website and blog so that
these values can be replaced.

Expect more forthcoming changes.

Change-Id: Ic2f5519e6b0d76fcb8b737bf50009e8388f1b178
Reviewed-on: https://cl.tvl.fyi/c/depot/+/4754
Tested-by: BuildkiteCI
Reviewed-by: wpcarro <wpcarro@gmail.com>
Autosubmit: wpcarro <wpcarro@gmail.com>
Diffstat (limited to 'users/wpcarro/website/blog')
-rw-r--r--users/wpcarro/website/blog/default.nix20
-rw-r--r--users/wpcarro/website/blog/fragments/posts.html2
2 files changed, 10 insertions, 12 deletions
diff --git a/users/wpcarro/website/blog/default.nix b/users/wpcarro/website/blog/default.nix
index 7056b026a21a..0eca77d9be3e 100644
--- a/users/wpcarro/website/blog/default.nix
+++ b/users/wpcarro/website/blog/default.nix
@@ -5,17 +5,17 @@ with depot.nix.yants;
 let
   inherit (builtins) hasAttr filter readFile;
   inherit (depot.web.blog) post includePost renderPost;
-  inherit (depot.users) wpcarro;
+  inherit (depot.users.wpcarro.website) domain renderTemplate withBrand;
 
   config = {
-    name = "wpcarro's blog";
-    baseUrl = "https://wpcarro.dev/blog";
+    name = "bill and his blog";
+    baseUrl = "https://${domain}/blog";
     footer = "";
   };
 
   posts = filter includePost (list post (import ./posts.nix));
 
-  rendered = pkgs.runCommandNoCC "wpcarros-blog-posts" {} ''
+  rendered = pkgs.runCommandNoCC "blog-posts" {} ''
     mkdir -p $out
 
     ${lib.concatStringsSep "\n" (map (post:
@@ -27,19 +27,17 @@ let
     date --date='@${toString date}' '+%B %e, %Y' > $out
   '');
 
-  postsHtml = readFile (pkgs.substituteAll {
-    src = ./fragments/posts.html;
+  postsHtml = renderTemplate ./fragments/posts.html {
     postsHtml = lib.concatStringsSep "\n" (map toPostHtml posts);
-  });
+  };
 
-  toPostHtml = post: readFile (pkgs.substituteAll {
-    src = ./fragments/post.html;
+  toPostHtml = post: readFile (renderTemplate ./fragments/post.html {
     postUrl = "${config.baseUrl}/posts/${post.key}.html";
     postTitle = post.title;
     postDate = formatDate post.date;
   });
-in pkgs.runCommandNoCC "wpcarros-blog" {} ''
+in pkgs.runCommandNoCC "blog" {} ''
   mkdir -p $out
-  cp ${wpcarro.website.render postsHtml} $out/index.html
+  cp ${withBrand (readFile postsHtml)} $out/index.html
   cp -r ${rendered} $out/posts
 ''
diff --git a/users/wpcarro/website/blog/fragments/posts.html b/users/wpcarro/website/blog/fragments/posts.html
index 699b28f366c0..a85a4b71101e 100644
--- a/users/wpcarro/website/blog/fragments/posts.html
+++ b/users/wpcarro/website/blog/fragments/posts.html
@@ -1,7 +1,7 @@
 <div class="max-w-sm md:max-w-prose mx-auto">
   <section class="pt-8 pb-14">
     <p class="font-bold pb-3 text-xl">
-      Personal blog by <a class="font-bold text-blue-600 hover:underline" href="https://wpcarro.dev">wpcarro</a>.
+      Personal blog by <a class="font-bold text-blue-600 hover:underline" href="@homepage@">Bill</a>.
     </p>
     <p class="text-gray-500">&gt; Half-baked musings lossily encoded.</p>
     <p class="text-gray-500">&gt; - misc reviewer</p>