fix(web/blog): make base URL configurable for atom feeds

This was previously hardcoded to tazj.in, which is not going to work
of course.

Instead it now takes the blog config which has a new baseUrl
parameter. For ease of use, the configs of my and the TVL blog have
been moved into a location that is accessible in the tree for reuse.

Change-Id: I94e71aaa7859db4380eb7013740a17f6b6a02620
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3777
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
This commit is contained in:
Vincent Ambo 2021-11-05 14:19:06 +01:00 committed by tazjin
parent bb980158a7
commit 875ef0a605
6 changed files with 19 additions and 17 deletions

View file

@ -40,8 +40,8 @@ let
fragments = import ./fragments.nix args;
# Functions for generating feeds for these blogs using //web/atom-feed.
toFeedEntry = defun [ post atom-feed.entry ] (post: rec {
id = "https://tazj.in/blog/${post.key}";
toFeedEntry = { baseUrl, ...}: defun [ post atom-feed.entry ] (post: rec {
id = "${baseUrl}/${post.key}";
title = post.title;
content = readFile (renderMarkdown post.content);
published = post.date;
@ -52,7 +52,6 @@ let
href = id;
};
});
in {
inherit post toFeedEntry;
inherit (fragments) renderPost;

View file

@ -59,7 +59,7 @@ let
<hr>
'';
renderPost = { name, footer }: post: runCommandNoCC "${post.key}.html" {} ''
renderPost = { name, footer, ... }: post: runCommandNoCC "${post.key}.html" {} ''
cat ${writeText "header.html" (header name post.title)} > $out
# Write the post title & date