refactor(web): Serve static assets to //web/homepage

Shuffles around the nginx locations that are served to ensure that all
static content will be served from tazj.in/static (including for the
blog).
This commit is contained in:
Vincent Ambo 2020-02-09 00:01:07 +00:00
parent e6002f95cd
commit 39854d71b2
3 changed files with 10 additions and 28 deletions

View file

@ -34,8 +34,6 @@ let
rendered = pkgs.third_party.runCommandNoCC "tazjins-blog" {} ''
mkdir -p $out
cp ${fragments.blogIndex posts} $out/index.html
${lib.concatStringsSep "\n" (map (post:
"cp ${fragments.renderPost post} $out/${post.key}.html"
) posts)}

View file

@ -20,15 +20,13 @@ let
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="tazjin&#39;s blog">
<link rel="stylesheet" type="text/css" href="static/blog.css" media="all">
<link rel="stylesheet" type="text/css" href="/static/tazjin.css" media="all">
<link rel="alternate" type="application/rss+xml" title="RSS-Feed" href="/rss.xml">
<title>tazjin&#39;s blog${lib.optionalString (title != "") (
": " + (escape title)
)}</title>
<title>tazjin&#39;s blog: ${escape title}</title>
</head>
<body>
<body class="light">
<header>
<h1><a class="unstyled-link" href="/">tazjin&#39;s blog</a> </h1>
<h1><a class="blog-title" href="/">tazjin&#39;s interblag</a> </h1>
<hr>
</header>
'';
@ -68,18 +66,6 @@ let
isDraft = post: (hasAttr "draft" post) && post.draft;
isUnlisted = post: (hasAttr "listed" post) && !post.listed;
includePost = post: !(isDraft post) && !(isUnlisted post);
indexEntry= post: "<li>a blog post</li>";
blogIndex = posts: writeText "blog-index.html" (lib.concatStrings (
[
(header "")
"<ul>"
]
++ (map indexEntry (filter includePost posts))
++ [
"</ul>"
footer
]));
in {
inherit blogIndex renderPost;
inherit renderPost;
}

View file

@ -6,7 +6,7 @@
writeText, writeShellScriptBin, nginx, lib,
# website content
blog
blog, website
}:
let
@ -44,15 +44,13 @@ let
server {
listen 8080 default_server;
root ${blog.rendered};
location /static {
alias ${blog.static}/;
}
root ${website};
${oldRedirects}
location / {
location /blog {
alias ${blog.rendered};
if ($request_uri ~ ^/(.*)\.html$) {
return 302 /$1;
}