From 2045542727561491b456ad6bee17a254ab7d8d36 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Sun, 1 Mar 2020 12:44:41 -0800 Subject: [PATCH] site: robots.txt (#524) Prevent Netlify preview environments from being indexed by search bots. If HUGO_ENV!=production, we return Disallow:/ Signed-off-by: Ahmet Alp Balkan --- site/config.yaml | 1 + site/layouts/robots.txt | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 site/layouts/robots.txt diff --git a/site/config.yaml b/site/config.yaml index 369c843218..825e5ebeb8 100644 --- a/site/config.yaml +++ b/site/config.yaml @@ -1,6 +1,7 @@ title: "Krew – kubectl plugin manager" baseURL: "https://krew.sigs.k8s.io/" languageCode: "en-us" +enableRobotsTXT: true disableKinds: - taxonomy - taxonomyTerm diff --git a/site/layouts/robots.txt b/site/layouts/robots.txt new file mode 100644 index 0000000000..125876c497 --- /dev/null +++ b/site/layouts/robots.txt @@ -0,0 +1,4 @@ +User-agent: * +{{ if ne ( getenv "HUGO_ENV" ) "production" -}} +Disallow: / +{{- end -}}