Skip to content
Draft
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
5 changes: 4 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ variables:
# build.js authenticates to the GitHub API with this token to avoid rate limits.
# The multiplatform buildx job reads EXTRA_DOCKER_ARGS (not the legacy inline
# --build-arg), so pass the token through there.
EXTRA_DOCKER_ARGS: "--build-arg GITHUB_USERNAME_TOKEN"
EXTRA_DOCKER_ARGS: "--build-arg GITHUB_USERNAME_TOKEN --build-arg SEARCH_ENGINES_DISABLED=false" # do not disable search engines by default
DOCKER_HOST:
value: 'tcp://docker:2376'
description: "Required to run dind inside k8s runners with TLS"
Expand Down Expand Up @@ -39,6 +39,9 @@ build:docker:

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

publish:image:
Expand Down
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
FROM node:26-alpine AS build
ARG GITHUB_USERNAME_TOKEN

ARG SEARCH_ENGINES_DISABLED
ENV HUGO_PARAMS_SEARCHENGINES_DISABLED=$SEARCH_ENGINES_DISABLED

WORKDIR /build-website
ADD https://github.com/gohugoio/hugo/releases/download/v0.166.0/hugo_0.166.0_Linux-64bit.tar.gz hugo.tar.gz
RUN echo "45228f5a52eb118b0ca168068f01d7df0447314a24056f1d29667ed9fc368308 hugo.tar.gz" | sha256sum -c
ADD https://github.com/gohugoio/hugo/releases/download/v0.167.0/hugo_0.167.0_Linux-64bit.tar.gz hugo.tar.gz
RUN echo "4d84519b9f619e6d4c3fb45a50157abeabeb724f859c60605f44c23def6e1169 hugo.tar.gz" | sha256sum -c
RUN tar -zxvf hugo.tar.gz
COPY package-lock.json package.json ./
RUN npm ci
Expand Down
6 changes: 6 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ theme = "cfbs-theme"
enableRobotsTXT = true
syntaxCSS = true

# this parameter is set by Hugo from HUGO_PARAMS_SEARCHENGINES_DISABLED environment variable
# that we define on the build stage
# it is false by defaut to avoid a case when it was accedntly not defined
[params.searchengines]
disabled = false

# Number of posts per page
[pagination]
pagerSize = 10
Expand Down
2 changes: 2 additions & 0 deletions themes/cfbs-theme/layouts/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
User-agent: *
{{ if .Site.Params.searchengines.disabled }}Disallow: /{{ end }}
Loading