zola: --base-url ignored by serve
Bug Report
The option -u
or --base-url
is not taken into account with the serve
command.
Environment
Zola version: 0.17.2
Expected Behavior
With the command zola serve -u 127.0.0.1/test/ -O
, I was expecting the server to open this URL and to make the site available at this URL.
Current Behavior
- the command opens this URL:
http://127.0.0.1:1111/
- the site is only partially available. The CSS and static items aren’t found.
- opening
http://127.0.0.1:1111/test/
leads to a 404 answer from the server.
Step to reproduce
Type the following command:
zola serve -u 127.0.0.1/test/ -O
The output is:
Building site...
Checking all internal links with anchors.
> Successfully checked 0 internal link(s) with anchors.
-> Creating 14 pages (0 orphan) and 1 sections
Done in 62ms.
Web server is available at http://127.0.0.1:1111
Listening for changes in \\?\D:\projects\web\test_blog\{config.toml,content,sass,static,templates}
Press Ctrl+C to stop
The browser opens this page: http://127.0.0.1:1111/
Other information
My config.toml file specifies a base URL on github.io. When I publish the website, it mostly works there except a few dangling URLs that I need to debug.
Used with the default options, e.g. zola serve -O
, it works fine too. It just makes it difficult to check those dangling links with a more realistic URL that includes a path after the IP.
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 1
- Comments: 22
@blueglyph @Keats As there hasn’t been any activity on this issue in some time and I don’t see any related PRs, would it be alright if I worked on a patch for this?
@Keats, I have thought a bit about a backward compatible solution that would allow users to fully customize the base URL. Check https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=f19b3126a567464a7e5903214a341cdb and tell me if you would like me to PR.