fix(web/blog): Parameterize renderPost with staticUrl
This was broken in my blog for way too long. Change-Id: I03c45c666d67006a4608a4b19d6167ab692e321d Reviewed-on: https://cl.tvl.fyi/c/depot/+/5905 Reviewed-by: wpcarro <wpcarro@gmail.com> Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: wpcarro <wpcarro@gmail.com> Tested-by: BuildkiteCI
This commit is contained in:
parent
9c7d8e791a
commit
e3a66cbd5d
2 changed files with 4 additions and 5 deletions
|
@ -11,6 +11,7 @@ let
|
|||
config = {
|
||||
name = "bill and his blog";
|
||||
baseUrl = "https://${domain}/blog";
|
||||
staticUrl = "https://static.tvl.fyi/latest";
|
||||
footer = "";
|
||||
};
|
||||
|
||||
|
|
|
@ -11,15 +11,13 @@ let
|
|||
inherit (pkgs) runCommand writeText;
|
||||
inherit (depot.nix) renderMarkdown;
|
||||
|
||||
staticUrl = "https://static.tvl.fyi/${depot.web.static.drvHash}";
|
||||
|
||||
# Generate a post list for all listed, non-draft posts.
|
||||
isDraft = post: (hasAttr "draft" post) && post.draft;
|
||||
isUnlisted = post: (hasAttr "listed" post) && !post.listed;
|
||||
|
||||
escape = replaceStrings [ "<" ">" "&" "'" ] [ "<" ">" "&" "'" ];
|
||||
|
||||
header = name: title: ''
|
||||
header = name: title: staticUrl: ''
|
||||
<!DOCTYPE html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
@ -61,8 +59,8 @@ let
|
|||
<hr>
|
||||
'';
|
||||
|
||||
renderPost = { name, footer, ... }: post: runCommand "${post.key}.html" { } ''
|
||||
cat ${writeText "header.html" (header name post.title)} > $out
|
||||
renderPost = { name, footer, staticUrl ? "https://static.tvl.fyi/${depot.web.static.drvHash}", ... }: post: runCommand "${post.key}.html" { } ''
|
||||
cat ${writeText "header.html" (header name post.title staticUrl)} > $out
|
||||
|
||||
# Write the post title & date
|
||||
echo '<article><h2 class="inline">${escape post.title}</h2>' >> $out
|
||||
|
|
Loading…
Reference in a new issue