Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command line flag to open localhost:1313 #13040

Closed
rjc123 opened this issue Nov 14, 2024 · 2 comments · Fixed by #13042
Closed

Command line flag to open localhost:1313 #13040

rjc123 opened this issue Nov 14, 2024 · 2 comments · Fixed by #13042
Assignees
Milestone

Comments

@rjc123
Copy link

rjc123 commented Nov 14, 2024

As a not-very-technical hugo user
I would like to generate my site locally to test (heavily using hugo server -D) and see it immediately upon build in a local browser.
So that I can review it works as I would have expected.

hugo server -D && open http://localhost:1313 doesn't function, as it requires the server command to complete before opening the browser
open http://localhost:1313 && hugo server -D does function as needed, but doesn't match the order one would think about these things.

The best result would be hugo server -D -o -- so that the browser opens to the localhost immediately on the first build of the site, leaving the server running.

@bep bep removed the NeedsTriage label Nov 14, 2024
@bep bep added this to the v0.139.0 milestone Nov 14, 2024
@bep
Copy link
Member

bep commented Nov 14, 2024

I think we have had this discussion before, and I think the argument against it was that it wasn't a good/simple multi platform way to do this. But I see now that this exists, which looks solid enough:

https://github.com/pkg/browser

As to flags, I would suggest we go for -O (uppercase). I have tried to make it lowercase=configuration, uppercase=actions. Some of the uppercase are a little bit borderline, but I think it makes sense.

So:

hugo server -O

@bep bep modified the milestones: v0.139.0, v0.138.0 Nov 14, 2024
@bep bep self-assigned this Nov 14, 2024
bep added a commit to bep/hugo that referenced this issue Nov 14, 2024
@bep bep closed this as completed in ac6962d Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants