Skip to content

Commit 662cc2f

Browse files
authored
Update doc-build.yml
Move noindex logic to the build job
1 parent c73bfc0 commit 662cc2f

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

.github/workflows/doc-build.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ jobs:
6868
make html
6969
cd ..
7070
71+
# If it's main branch, add noindex tag to all .html files to exclude from Google Search indexing.
72+
echo "Ref name: ${REF_NAME}"
73+
if [[ "${{ github.ref }}" == 'refs/heads/main' ]]; then
74+
find docs/_build/html/ -name "*.html" -print0 | xargs -0 sed -i '/<head>/a \ \ <meta name="robots" content="noindex">';
75+
fi
76+
7177
cp -rf docs/_build/html/* "${RUNNER_DOCS_DIR}"
7278
7379
mv docs/_build/html "${RUNNER_ARTIFACT_DIR}"
@@ -91,13 +97,6 @@ jobs:
9197
REF_TYPE=${{ github.ref_type }}
9298
REF_NAME=${{ github.ref_name }}
9399
94-
# If it's main branch, add noindex tag to all .html files to exclude from Google Search indexing.
95-
REF_NAME=$(echo "${{ github.ref }}")
96-
echo "Ref name: ${REF_NAME}"
97-
if [[ "${{ github.ref }}" == 'refs/heads/main' ]]; then
98-
find docs -name "*.html" -print0 | xargs -0 sed -i '/<head>/a \ \ <meta name="robots" content="noindex">';
99-
fi
100-
101100
# If building for a release tag, branch, set the branch/tag name
102101
# as the target folder in the gh-pages branch. The artifacts created
103102
# during the build will be copied over to the target dir in the

0 commit comments

Comments
 (0)