diff options
author | Ben Sima <ben@bsima.me> | 2023-09-28 19:57:27 -0400 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2023-10-27 10:06:55 -0400 |
commit | c467f7611f66b6d9b9dcb589ed534374cd7b2e6c (patch) | |
tree | 3aa45ee9bdf237ed6cd2d15925ed7a4a7a4b822f /Biz | |
parent | 263bd6eb4dc90be7b773ecaf72e26b3a03a7a3f2 (diff) |
Disallow search engines from indexing my code
I don't really want my code to be discoverable, I only want people looking at it
if I have explicitly told them about it.
I tested it like so:
ϟ curl -v https://simatime.com/git/ 2>&1 | rg x-robots
< x-robots-tag: noindex, follow
Diffstat (limited to 'Biz')
-rw-r--r-- | Biz/Cloud/Cgit.nix | 15 | ||||
-rw-r--r-- | Biz/Cloud/Git.nix | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/Biz/Cloud/Cgit.nix b/Biz/Cloud/Cgit.nix index 78eda7b..0b3a71b 100644 --- a/Biz/Cloud/Cgit.nix +++ b/Biz/Cloud/Cgit.nix @@ -36,6 +36,14 @@ in Location to serve cgit on. ''; }; + + allowCrawlers = mkOption { + default = true; + type = types.bool; + description = '' + Allow search engines to crawl and index this site. + ''; + }; }; # Remove the global options for serialization into cgitrc @@ -108,6 +116,13 @@ in fastcgi_split_path_info ^(${location}/)(/?.+)$; fastcgi_param PATH_INFO $fastcgi_path_info; '' + ) + ( + if !cfg.allowCrawlers + then + '' + add_header X-Robots-Tag "noindex, follow" always; + '' + else "" ); }; }; diff --git a/Biz/Cloud/Git.nix b/Biz/Cloud/Git.nix index 49bc96b..6e3d8c8 100644 --- a/Biz/Cloud/Git.nix +++ b/Biz/Cloud/Git.nix @@ -36,6 +36,7 @@ in { nginx.virtualHosts.${domain}.cgit = { enable = true; location = "/git"; + allowCrawlers = false; virtual-root = "/git"; css = "/git/cgit.css"; logo = "/git/cgit.png"; |