Skip to content

Commit 0a39160

Browse files
committed
ci: provide hugo baseURL via env var
`npm run build` now runs `hugo ... && npm run highlight` instead of just `hugo ...`, so the --baseURL flag was not actually being set. Miraculously this has not yet led to issues in prod, but do it the right way to be safe anyway.
1 parent 2c58a4d commit 0a39160

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

.github/workflows/hugo.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ concurrency:
1818

1919
env:
2020
HUGO_CACHEDIR: /tmp/hugo_cache/
21-
HUGO_BASE_URL: 'https://docs-beta.yagpdb.xyz'
21+
HUGO_BASEURL: 'https://docs-beta.yagpdb.xyz'
2222

2323
jobs:
2424
build:
@@ -46,9 +46,7 @@ jobs:
4646
[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true
4747
4848
- name: Build website
49-
# See https://discourse.gohugo.io/t/solved-what-should-be-used-for-the-value-of-site-baseurl/5896
50-
# for why we set baseURL here and not in hugo.toml.
51-
run: npm run build -- --baseURL=${{ env.HUGO_BASE_URL }}
49+
run: npm run build
5250

5351
- name: Setup Pages
5452
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ an experiment to see if it is a viable alternative.
1010
Install [Node.js](https://nodejs.org/en), clone this repository, install the dependencies with `npm install`, and run
1111
`npm run dev` to start a local server. The server will automatically rebuild the page when you make changes.
1212

13-
To build the page in release mode, use `npm run build -- --baseURL ...`\*, then serve the generated `public/` directory
13+
To build the page in release mode, use `HUGO_BASEURL=... npm run build`, then serve the generated `public/` directory
1414
with your webserver of choice.
1515

1616
For more information, please view our [Contributing Guidelines](.github/CONTRIBUTING.md).
1717

18-
_\*The `--` serves to pass `baseURL` to Hugo as opposed to the `npm run` command._
19-
2018
### Editor Setup
2119

2220
As this project uses the [EditorConfig](https://editorconfig.org/) standard, you will have to make sure that your

0 commit comments

Comments
 (0)