Skip to content

Commit 302f897

Browse files
committed
Handle branch deletion
1 parent 749db23 commit 302f897

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

.github/workflows/branch-deleted.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
fetch-depth: 0
1313
ref: hakyll
1414

15-
- name: Remove stale deployments
15+
- name: Remove deployment for deleted branch
1616
run: |
1717
./.github/workflows/deployment/delete.sh ${{ github.event.ref }}
1818
./.github/workflows/deployment/update-deployments-list.sh

.github/workflows/deployment/deploy.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ set -eo pipefail
77
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
88
source $script_dir/commons.sh
99

10-
# Monkey patch html files by adding <meta name="robots" content="noindex, nofollow">.
11-
# It will tell search bots like googlebot not to index this content.
12-
search_robots_noindex() {
13-
# find
14-
}
15-
1610
deploy() {
1711
if [[ ! -z "$GITHUB_REF_NAME" ]]; then
1812
# The GITHUB_REF_NAME env variable is available in github actions.
@@ -39,6 +33,10 @@ deploy() {
3933
# Restore temporary backup for other branches content.
4034
mv ./branches "${gh_pages_dir}/"
4135
else
36+
# Patch html files to tell search engine bots like google-bot not to index this content.
37+
# More info: https://developers.google.com/search/docs/advanced/crawling/block-indexing
38+
find $site_src -name '*.html' -exec sed -i 's/<head>/<head><meta name="robots" content="noindex, nofollow">/g' {}
39+
4240
branch_slug=$(slugify $git_branch)
4341
site_dest="${gh_pages_dir}/branches/${branch_slug}"
4442

0 commit comments

Comments
 (0)