Skip to content

Commit 1e812af

Browse files
committed
fix: base url
Signed-off-by: Aritra Dey <[email protected]>
1 parent 63f33bd commit 1e812af

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.github/workflows/publish-docs.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,18 @@ jobs:
3232
with:
3333
node-version: 20
3434

35+
- name: Calculate BASE_URL
36+
run: |
37+
if [[ "${{ github.event.repository.name }}" == "${{ github.repository_owner }}.github.io" ]]; then
38+
echo "BASE_URL=/pr-preview/pr-${{ github.event.pull_request.number }}/" >> $GITHUB_ENV
39+
else
40+
echo "BASE_URL=/${{ github.event.repository.name }}/pr-preview/pr-${{ github.event.pull_request.number }}/" >> $GITHUB_ENV
41+
fi
42+
3543
- name: Install and Build
3644
run: npm ci && npm run build
45+
env:
46+
BASE_URL: ${{ env.BASE_URL }}
3747

3848
- name: Deploy Preview
3949
uses: rossjrw/pr-preview-action@v1

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: "/",
7+
baseUrl: process.env.BASE_URL || "/",
88
onBrokenLinks: "ignore",
99
onBrokenMarkdownLinks: "warn",
1010
favicon: "img/favicon.ico",

0 commit comments

Comments
 (0)