forked from mirrors_public/oddlama_nix-config
feat: add plausible analytics for blog
This commit is contained in:
parent
3383fd9a14
commit
c30ec709a7
16 changed files with 277 additions and 91 deletions
33
hosts/sentinel/blog.nix
Normal file
33
hosts/sentinel/blog.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
globals,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
services.nginx.virtualHosts.${globals.domains.me} = {
|
||||
forceSSL = true;
|
||||
useACMEWildcardHost = true;
|
||||
locations."/".root = pkgs.runCommand "index.html" {} ''
|
||||
mkdir -p $out
|
||||
cat > $out/index.html <<EOF
|
||||
<html>
|
||||
<head>
|
||||
<script defer data-api="/api/event" data-domain="oddlama.org" src="/js/script.js"></script>
|
||||
</head>
|
||||
<body>Not empty soon TM. Until then please go here: <a href="https://github.com/oddlama">oddlama</a></body>
|
||||
</html>
|
||||
EOF
|
||||
'';
|
||||
# Don't use the proxyPass option because we don't want the recommended proxy headers
|
||||
locations."= /js/script.js".extraConfig = ''
|
||||
proxy_pass https://${globals.services.plausible.domain}/js/script.js;
|
||||
proxy_set_header Host ${globals.services.plausible.domain};
|
||||
proxy_ssl_server_name on;
|
||||
'';
|
||||
locations."= /api/event".extraConfig = ''
|
||||
proxy_pass https://${globals.services.plausible.domain}/api/event;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host ${globals.services.plausible.domain};
|
||||
proxy_ssl_server_name on;
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue