From 4920a516651e89e2b51513b14bb18746f0e1ddc6 Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Mon, 6 Aug 2018 14:19:16 -0700 Subject: [PATCH] Revert 9225, fix indexing for k8s.io (#9767) --- layouts/index.headers | 2 -- netlify.toml | 9 ++++++++- netlify_noindex_headers.txt | 3 +++ 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 netlify_noindex_headers.txt diff --git a/layouts/index.headers b/layouts/index.headers index 3c7e9913b79..a456a296f55 100644 --- a/layouts/index.headers +++ b/layouts/index.headers @@ -1,8 +1,6 @@ {{- $cssFilesFromConfig := .Site.Params.pushAssets.css -}} {{- $jsFilesFromConfig := .Site.Params.pushAssets.js -}} {{- $pages := .Site.RegularPages -}} -/* - X-Robots-Tag: noindex Link: ; rel=preload; as=image {{- range $cssFilesFromConfig -}} {{- $cssUrl := printf "/css/%s.css" . }} diff --git a/netlify.toml b/netlify.toml index 8a34939ec72..36625b6a550 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,6 +1,8 @@ [build] +# This default build command adds the robots noindex directive to the site headers. +# It is turned off ONLY for the `master` branch deployment on kubernetes.io publish = "public" -command = "hugo" +command = "hugo --enableGitInfo && cp netlify_noindex_headers.txt public/_headers" [build.environment] HUGO_VERSION = "0.46" @@ -15,3 +17,8 @@ command = "hugo --enableGitInfo -b $DEPLOY_PRIME_URL" [context.branch-deploy] command = "hugo --enableGitInfo -b $DEPLOY_PRIME_URL" + +[context.master] +# This context is triggered by the master branch and allows search indexing +publish = "public" +command = "hugo" diff --git a/netlify_noindex_headers.txt b/netlify_noindex_headers.txt new file mode 100644 index 00000000000..221563cc13f --- /dev/null +++ b/netlify_noindex_headers.txt @@ -0,0 +1,3 @@ +# Prevent bots from indexing site +/* + X-Robots-Tag: noindex \ No newline at end of file