Merge pull request #31376 from sftim/20211207_mark_only_live_site_indexable_v1.20
Mark only live site indexable (v1.20 backport)pull/32478/head
commit
fbe9dd1db2
24
Makefile
24
Makefile
|
@ -23,14 +23,14 @@ module-check:
|
||||||
|
|
||||||
all: build ## Build site with production settings and put deliverables in ./public
|
all: build ## Build site with production settings and put deliverables in ./public
|
||||||
|
|
||||||
build: module-check ## Build site with production settings and put deliverables in ./public
|
build: module-check ## Build site with non-production settings and put deliverables in ./public
|
||||||
hugo --minify
|
hugo --minify --environment development
|
||||||
|
|
||||||
build-preview: module-check ## Build site with drafts and future posts enabled
|
build-preview: module-check ## Build site with drafts and future posts enabled
|
||||||
hugo --buildDrafts --buildFuture
|
hugo --buildDrafts --buildFuture --environment preview
|
||||||
|
|
||||||
deploy-preview: ## Deploy preview site via netlify
|
deploy-preview: ## Deploy preview site via netlify
|
||||||
hugo --enableGitInfo --buildFuture -b $(DEPLOY_PRIME_URL)
|
hugo --enableGitInfo --buildFuture --environment preview -b $(DEPLOY_PRIME_URL)
|
||||||
|
|
||||||
functions-build:
|
functions-build:
|
||||||
$(NETLIFY_FUNC) build functions-src
|
$(NETLIFY_FUNC) build functions-src
|
||||||
|
@ -38,13 +38,15 @@ functions-build:
|
||||||
check-headers-file:
|
check-headers-file:
|
||||||
scripts/check-headers-file.sh
|
scripts/check-headers-file.sh
|
||||||
|
|
||||||
production-build: build check-headers-file ## Build the production site and ensure that noindex headers aren't added
|
production-build: module-check ## Build the production site and ensure that noindex headers aren't added
|
||||||
|
hugo --minify --environment production
|
||||||
|
HUGO_ENV=production $(MAKE) check-headers-file
|
||||||
|
|
||||||
non-production-build: ## Build the non-production site, which adds noindex headers to prevent indexing
|
non-production-build: module-check ## Build the non-production site, which adds noindex headers to prevent indexing
|
||||||
hugo --enableGitInfo
|
hugo --enableGitInfo --environment nonprod
|
||||||
|
|
||||||
serve: module-check ## Boot the development server.
|
serve: module-check ## Boot the development server.
|
||||||
hugo server --buildFuture
|
hugo server --buildFuture --environment development
|
||||||
|
|
||||||
docker-image:
|
docker-image:
|
||||||
@echo -e "$(CCRED)**** The use of docker-image is deprecated. Use container-image instead. ****$(CCEND)"
|
@echo -e "$(CCRED)**** The use of docker-image is deprecated. Use container-image instead. ****$(CCEND)"
|
||||||
|
@ -65,10 +67,10 @@ container-image: ## Build a container image for the preview of the website
|
||||||
--build-arg HUGO_VERSION=$(HUGO_VERSION)
|
--build-arg HUGO_VERSION=$(HUGO_VERSION)
|
||||||
|
|
||||||
container-build: module-check
|
container-build: module-check
|
||||||
$(CONTAINER_RUN) --read-only --mount type=tmpfs,destination=/tmp,tmpfs-mode=01777 $(CONTAINER_IMAGE) sh -c "npm ci && hugo --minify"
|
$(CONTAINER_RUN) --read-only --mount type=tmpfs,destination=/tmp,tmpfs-mode=01777 $(CONTAINER_IMAGE) sh -c "npm ci && hugo --minify --environment development"
|
||||||
|
|
||||||
container-serve: module-check ## Boot the development server using container. Run `make container-image` before this.
|
container-serve: module-check ## Boot the development server using container. Run `make container-image` before this.
|
||||||
$(CONTAINER_RUN) --read-only --mount type=tmpfs,destination=/tmp,tmpfs-mode=01777 -p 1313:1313 $(CONTAINER_IMAGE) hugo server --buildFuture --bind 0.0.0.0 --destination /tmp/hugo --cleanDestinationDir
|
$(CONTAINER_RUN) --read-only --mount type=tmpfs,destination=/tmp,tmpfs-mode=01777 -p 1313:1313 $(CONTAINER_IMAGE) hugo server --buildFuture --environment development --bind 0.0.0.0 --destination /tmp/hugo --cleanDestinationDir
|
||||||
|
|
||||||
test-examples:
|
test-examples:
|
||||||
scripts/test_examples.sh install
|
scripts/test_examples.sh install
|
||||||
|
@ -83,7 +85,7 @@ docker-internal-linkcheck:
|
||||||
$(MAKE) container-internal-linkcheck
|
$(MAKE) container-internal-linkcheck
|
||||||
|
|
||||||
container-internal-linkcheck: link-checker-image-pull
|
container-internal-linkcheck: link-checker-image-pull
|
||||||
$(CONTAINER_RUN) $(CONTAINER_IMAGE) hugo --config config.toml,linkcheck-config.toml --buildFuture
|
$(CONTAINER_RUN) $(CONTAINER_IMAGE) hugo --config config.toml,linkcheck-config.toml --buildFuture --environment test
|
||||||
$(CONTAINER_ENGINE) run --mount type=bind,source=$(CURDIR),target=/test --rm wjdp/htmltest htmltest
|
$(CONTAINER_ENGINE) run --mount type=bind,source=$(CURDIR),target=/test --rm wjdp/htmltest htmltest
|
||||||
|
|
||||||
clean-api-reference: ## Clean all directories in API reference directory, preserve _index.md
|
clean-api-reference: ## Clean all directories in API reference directory, preserve _index.md
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="{{ .Site.Language.Lang }}" class="{{.Params.class}} no-js">
|
<html lang="{{ .Site.Language.Lang }}" class="{{.Params.class}} no-js">
|
||||||
<head>
|
{{- if eq hugo.Environment "preview" -}}
|
||||||
|
<!-- deploy preview -->
|
||||||
|
{{- end -}}
|
||||||
|
<head {{- if hugo.IsProduction -}}class="live-site"{{- end -}}>
|
||||||
{{ partial "head.html" . }}
|
{{ partial "head.html" . }}
|
||||||
</head>
|
</head>
|
||||||
<body class="td-{{ .Kind }}{{- if ne .Params.cid "" -}}{{- printf " cid-%s" (lower .Params.cid) -}}{{- end -}}">
|
<body class="td-{{ .Kind }}{{- if ne .Params.cid "" -}}{{- printf " cid-%s" (lower .Params.cid) -}}{{- end -}}">
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{{- if eq (getenv "HUGO_ENV") "production" }}
|
{{- if eq hugo.Environment "production" }}
|
||||||
{{- $cssFilesFromConfig := site.Params.pushAssets.css -}}
|
{{- $cssFilesFromConfig := site.Params.pushAssets.css -}}
|
||||||
{{- $jsFilesFromConfig := site.Params.pushAssets.js -}}
|
{{- $jsFilesFromConfig := site.Params.pushAssets.js -}}
|
||||||
{{- $pages := site.RegularPages -}}
|
{{- $pages := site.RegularPages -}}
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
{{- $isBlogPost := eq .Section "blog" }}
|
{{- $isBlogPost := eq .Section "blog" }}
|
||||||
{{- $ogType := cond (.IsHome) "website" "article" }}
|
{{- $ogType := cond (.IsHome) "website" "article" }}
|
||||||
|
<!-- per-page robot indexing controls -->
|
||||||
|
{{- if hugo.IsProduction -}}
|
||||||
|
<meta name="ROBOTS" content="INDEX, FOLLOW">
|
||||||
|
{{- else -}}
|
||||||
|
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
|
||||||
|
{{- end -}}
|
||||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-36037335-10"></script>
|
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-36037335-10"></script>
|
||||||
<script>
|
<script>
|
||||||
|
@ -19,11 +25,6 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
{{ hugo.Generator }}
|
{{ hugo.Generator }}
|
||||||
{{ if eq (getenv "HUGO_ENV") "production" }}
|
|
||||||
<META NAME="ROBOTS" CONTENT="INDEX, FOLLOW">
|
|
||||||
{{ else }}
|
|
||||||
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
|
|
||||||
{{ end }}
|
|
||||||
{{ range .AlternativeOutputFormats -}}
|
{{ range .AlternativeOutputFormats -}}
|
||||||
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}">
|
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}">
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
|
@ -33,7 +34,7 @@
|
||||||
{{- template "_internal/google_news.html" . -}}
|
{{- template "_internal/google_news.html" . -}}
|
||||||
{{- template "_internal/schema.html" . -}}
|
{{- template "_internal/schema.html" . -}}
|
||||||
{{- template "_internal/twitter_cards.html" . -}}
|
{{- template "_internal/twitter_cards.html" . -}}
|
||||||
{{ if eq (getenv "HUGO_ENV") "production" }}
|
{{- if hugo.IsProduction -}}
|
||||||
{{ template "_internal/google_analytics_async.html" . }}
|
{{ template "_internal/google_analytics_async.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ partialCached "head-css.html" . "asdf" }}
|
{{ partialCached "head-css.html" . "asdf" }}
|
||||||
|
|
13
netlify.toml
13
netlify.toml
|
@ -20,17 +20,10 @@ HUGO_ENABLEGITINFO = "true"
|
||||||
command = "git submodule update --init --recursive --depth 1 && make deploy-preview"
|
command = "git submodule update --init --recursive --depth 1 && make deploy-preview"
|
||||||
|
|
||||||
[context.branch-deploy]
|
[context.branch-deploy]
|
||||||
command = "git submodule update --init --recursive --depth 1 && make deploy-preview"
|
command = "git submodule update --init --recursive --depth 1 && make non-production-build"
|
||||||
|
|
||||||
[context.master]
|
[context.main]
|
||||||
# This context is triggered by the `master` branch and allows search indexing
|
# This context is triggered by the `main` branch and allows search indexing
|
||||||
# DO NOT REMOVE THIS (contact @kubernetes/sig-docs-leads)
|
# DO NOT REMOVE THIS (contact @kubernetes/sig-docs-leads)
|
||||||
publish = "public"
|
publish = "public"
|
||||||
command = "git submodule update --init --recursive --depth 1 && make production-build"
|
command = "git submodule update --init --recursive --depth 1 && make production-build"
|
||||||
|
|
||||||
# adding in headers to prevent clickjacking
|
|
||||||
[[headers]]
|
|
||||||
for = "/*"
|
|
||||||
[headers.values]
|
|
||||||
X-Frame-Options = "DENY"
|
|
||||||
X-XSS-Protection = "1; mode=block"
|
|
||||||
|
|
Loading…
Reference in New Issue