Skip to content

Commit 7a6efdb

Browse files
committed
Prevent Indexing of Github Pages used as Staging Sites
1 parent d6a0763 commit 7a6efdb

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

.github/workflows/main.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,18 @@ on:
44
push:
55
branches: ["main"]
66

7-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
87
permissions:
98
contents: read
109
pages: write
1110
id-token: write
1211

13-
# Environment variables available to all jobs and steps in this workflow
1412
env:
1513
HUGO_ENV: production
1614
HUGO_VERSION: "0.118.2"
1715
GO_VERSION: "1.20.5"
1816
NODE_VERSION: "18.15.0"
1917

2018
jobs:
21-
# Build job
2219
build:
2320
runs-on: ubuntu-24.04-arm
2421
steps:
@@ -65,6 +62,13 @@ jobs:
6562
6663
- name: Modify hugo.toml
6764
run: sed -i "s|baseURL = .*|baseURL = \"$BASE_URL\"|" hugo.toml
65+
66+
- name: Modify .htaccess (Prevent Indexing)
67+
run: |
68+
if [[ "$BASE_URL" != "https://open-neuromorphic.org/" ]]; then
69+
echo "Header set X-Robots-Tag \"noindex, nofollow\"" >> public/.htaccess
70+
fi
71+
6872
- name: Build site
6973
run: npm run build
7074

@@ -73,7 +77,6 @@ jobs:
7377
with:
7478
path: ./public
7579

76-
# Deployment job
7780
deploy:
7881
environment:
7982
name: github-pages

0 commit comments

Comments
 (0)