Skip to content

Commit 9fa8d76

Browse files
authored
Merge pull request #295 from aleksandrychev/ENT-14726
ENT-14726: Excluded staging from the search indexes
2 parents bda463c + 75b7376 commit 9fa8d76

4 files changed

Lines changed: 16 additions & 1 deletion

File tree

‎.gitlab-ci.yml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ variables:
66
# build.js authenticates to the GitHub API with this token to avoid rate limits.
77
# The multiplatform buildx job reads EXTRA_DOCKER_ARGS (not the legacy inline
88
# --build-arg), so pass the token through there.
9-
EXTRA_DOCKER_ARGS: "--build-arg GITHUB_USERNAME_TOKEN"
9+
EXTRA_DOCKER_ARGS: "--build-arg GITHUB_USERNAME_TOKEN --build-arg SEARCH_ENGINES_DISABLED=false" # do not disable search engines by default
1010
DOCKER_HOST:
1111
value: 'tcp://docker:2376'
1212
description: "Required to run dind inside k8s runners with TLS"
@@ -39,6 +39,9 @@ build:docker:
3939

4040
build:docker-multiplatform:
4141
rules:
42+
- if: '$CI_COMMIT_BRANCH == "master"'
43+
variables:
44+
EXTRA_DOCKER_ARGS: "--build-arg GITHUB_USERNAME_TOKEN --build-arg SEARCH_ENGINES_DISABLED=true" # disable if the branch is master (staging)
4245
- if: '$CI_COMMIT_BRANCH =~ /^(master|production)$/'
4346

4447
publish:image:

‎Dockerfile‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
FROM node:26-alpine AS build
22
ARG GITHUB_USERNAME_TOKEN
3+
4+
ARG SEARCH_ENGINES_DISABLED
5+
ENV HUGO_PARAMS_SEARCHENGINES_DISABLED=$SEARCH_ENGINES_DISABLED
6+
37
WORKDIR /build-website
48
ADD https://github.com/gohugoio/hugo/releases/download/v0.167.0/hugo_0.167.0_Linux-64bit.tar.gz hugo.tar.gz
59
RUN echo "4d84519b9f619e6d4c3fb45a50157abeabeb724f859c60605f44c23def6e1169 hugo.tar.gz" | sha256sum -c

‎config.toml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ theme = "cfbs-theme"
66
enableRobotsTXT = true
77
syntaxCSS = true
88

9+
# this parameter is set by Hugo from HUGO_PARAMS_SEARCHENGINES_DISABLED environment variable
10+
# that we define on the build stage
11+
# it is false by defaut to avoid a case when it was accedntly not defined
12+
[params.searchengines]
13+
disabled = false
14+
915
# Number of posts per page
1016
[pagination]
1117
pagerSize = 10
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
User-agent: *
2+
{{ if .Site.Params.searchengines.disabled }}Disallow: /{{ end }}

0 commit comments

Comments
 (0)