Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix indexing for k8s.io #9767

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions layouts/index.headers
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{{- $cssFilesFromConfig := .Site.Params.pushAssets.css -}}
{{- $jsFilesFromConfig := .Site.Params.pushAssets.js -}}
{{- $pages := .Site.RegularPages -}}
/*
X-Robots-Tag: noindex
Link: </images/favicon.png>; rel=preload; as=image
{{- range $cssFilesFromConfig -}}
{{- $cssUrl := printf "/css/%s.css" . }}
Expand Down
9 changes: 8 additions & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
3 changes: 3 additions & 0 deletions netlify_noindex_headers.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Prevent bots from indexing site
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this comment still unclosed?

Copy link
Contributor Author

@chenopis chenopis Aug 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, that's actually not an opening comment delimiter. It's specifying that the header tag should be for all the pages in the site, similar to file path syntax on the command line, e.g. rm -rf /* LOL. See https://www.netlify.com/docs/headers-and-basic-auth/

X-Robots-Tag: noindex