diff --git a/_includes/head.html b/_includes/head.html index 24e24e2fb0..2b20999c5c 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -30,7 +30,7 @@ {%- endif -%} - {%- if page.sitemap == false or site.GH_ENV == "gh_pages" %} + {%- if page.sitemap == false or jekyll.environment != 'production' %} {%- endif %} {%- if jekyll.environment == 'production' and site.google_analytics != '' -%}{%- include analytics/google_analytics.html GOOGLE_ID=site.google_analytics -%}{%- endif -%} diff --git a/robots.txt b/robots.txt index 0029ff5a26..9decfe1b83 100644 --- a/robots.txt +++ b/robots.txt @@ -1,3 +1,7 @@ +--- +layout: null +--- +{%- if jekyll.environment == 'production' -%} User-agent: * # Docker Engine archives @@ -26,3 +30,9 @@ Disallow: /ee/ Disallow: /apidocs/v* Sitemap: https://docs.docker.com/sitemap.xml +{%- else -%} +# Disable all indexing on staging websites and Netlify previews to prevent +# them showing up in search results. +User-agent: * +Disallow: / +{%- endif %}