Skip to content

Commit 05f35ef

Browse files
authored
Merge pull request #40 from Paritoshcodes/fix-sitemap-local-url
Fix sitemap URLs when serving locally
2 parents c7ee814 + 6c657d0 commit 05f35ef

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/render_engine_cli/cli.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,13 @@ def serve(module_site: str, clean: bool, reload: bool, port: int):
192192
module, site_name = split_module_site(module_site)
193193
site = get_site(module, site_name)
194194

195+
server_address = ("127.0.0.1", port)
196+
195197
if clean:
196198
remove_output_folder(Path(site.output_path), console=console)
197-
site.render()
198199

199-
server_address = ("127.0.0.1", port)
200+
local_url = f"http://{server_address[0]}:{server_address[1]}"
201+
site.render(site_url=local_url)
200202

201203
handler = ServerEventHandler(
202204
import_path=module,

src/render_engine_cli/event.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ def rebuild(self) -> None:
9393
if self.clean:
9494
remove_output_folder(Path(site.output_path), console=self.console)
9595
try:
96-
site.render()
96+
local_url = f"http://{self.server_address[0]}:{self.server_address[1]}"
97+
site.render(site_url=local_url)
9798
except Exception:
9899
self.console.print("[bold red]Failed to render site[/bold red]")
99100
self.console.print(traceback.format_exc())

0 commit comments

Comments
 (0)