From: XhmikosR Date: Fri, 2 Aug 2019 14:26:25 +0000 (+0300) Subject: robots.txt: adapt for Netlify. (#29192) X-Git-Tag: v5.0.0-alpha1~880 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ebb8e7d9b4bd52c7fc088aeaec12ab9bcb240c6;p=thirdparty%2Fbootstrap.git robots.txt: adapt for Netlify. (#29192) Since we build with `HUGO_ENV` set to `production` on Netlify, use another variable to prevent crawling. --- diff --git a/site/layouts/robots.txt b/site/layouts/robots.txt index e9d78f1aed..c6703cd06c 100644 --- a/site/layouts/robots.txt +++ b/site/layouts/robots.txt @@ -1,8 +1,12 @@ # www.robotstxt.org -{{ if (eq (getenv "HUGO_ENV") "production") -}} +{{- $isProduction := eq (getenv "HUGO_ENV") "production" -}} +{{- $isNetlify := eq (getenv "NETLIFY") "true" -}} +{{- $allowCrawling := and (not $isNetlify) $isProduction -}} + +{{ if $allowCrawling }} # Allow crawling of all content {{- end }} User-agent: * -Disallow:{{ if (ne (getenv "HUGO_ENV") "production") }} /{{ end }} +Disallow:{{ if not $allowCrawling }} /{{ end }} Sitemap: {{ .Site.BaseURL }}/sitemap.xml