Skip to content

Commit fe0fba2

Browse files
committed
it should work
Signed-off-by: Aritra Dey <adey01027@gmail.com>
1 parent fa0de12 commit fe0fba2

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

.github/workflows/publish-docs.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,20 @@ jobs:
3131
- name: Install dependencies
3232
run: npm ci
3333

34+
- name: Calculate BASE_URL
35+
run: |
36+
REPO_NAME=${GITHUB_REPOSITORY#*/}
37+
OWNER_NAME=${GITHUB_REPOSITORY%/*}
38+
if [[ "$REPO_NAME" == "$OWNER_NAME.github.io" ]]; then
39+
echo "BASE_URL=/" >> $GITHUB_ENV
40+
else
41+
echo "BASE_URL=/$REPO_NAME/" >> $GITHUB_ENV
42+
fi
43+
3444
- name: Build
3545
run: npm run build
46+
env:
47+
BASE_URL: ${{ env.BASE_URL }}
3648

3749
- name: Upload build artifact
3850
uses: actions/upload-artifact@v4

docusaurus.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = {
44
tagline:
55
"Ecosystem science, policy, and management informed by the best available data and models",
66
url: "https://pecanproject.github.io",
7-
baseUrl: process.env.GITHUB_ACTIONS ? `${process.env.BASE_URL}/` : "/",
7+
baseUrl: process.env.BASE_URL || "/",
88
onBrokenLinks: "ignore",
99
onBrokenMarkdownLinks: "warn",
1010
favicon: "img/favicon.ico",

0 commit comments

Comments
 (0)