aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-09-12 23:27:49 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-09-12 23:27:49 +0800
commite7ad5be0b3ebf82e0678def45ed3092ec6bffed0 (patch)
tree66c4ea27cb1dadf2edd86a4d28533e25f4e39725
parentecf59bf15d2a67414267b074778bc8da4aa49e47 (diff)
downloadrhomepage-e7ad5be0b3ebf82e0678def45ed3092ec6bffed0.tar.gz
rhomepage-e7ad5be0b3ebf82e0678def45ed3092ec6bffed0.tar.xz
Make base URL configurable
-rw-r--r--Makefile5
-rw-r--r--README.md2
2 files changed, 4 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 8356ec6..e6b1d33 100644
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,15 @@
HUGO ?= hugo
PORT ?= 1314
+BASE_URL ?= http://localhost:1314/
.PHONY: build serve clean
build: clean
- $(HUGO)
+ $(HUGO) --baseURL "$(BASE_URL)"
./scripts/publish-raw
serve: build
- $(HUGO) server --disableFastRender --disableLiveReload --port $(PORT)
+ $(HUGO) server --disableFastRender --disableLiveReload --port $(PORT) --baseURL "http://localhost:$(PORT)/"
clean:
$(RM) -r public resources .hugo_build.lock
diff --git a/README.md b/README.md
index 8b2d67f..638ea52 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ make serve
make clean
```
-`make build` recreates `public/`, runs Hugo, and then copies every public Markdown source and its page-bundle attachments without changing their bytes. `make serve` prepares that same output before starting Hugo at `http://localhost:1314/`; override the port with `make serve PORT=8080`. Hugo rebuilds HTML while serving; restart the command after editing Markdown when the raw `.md` snapshot also needs to change.
+`make build` recreates `public/`, runs Hugo, and then copies every public Markdown source and its page-bundle attachments without changing their bytes. The default `BASE_URL` is `http://localhost:1314/`; pass `BASE_URL=https://example.org/` to generate absolute production URLs. `make serve` prepares that same output before starting Hugo at `http://localhost:1314/`; override the port with `make serve PORT=8080`. Hugo rebuilds HTML while serving; restart the command after editing Markdown when the raw `.md` snapshot also needs to change.
The source repository URL, per-file Git base URL, and public email are configured once in `hugo.toml`.