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

Hugo watch (-w) without server injects livereload.js that is unreachable #11061

Closed
istr opened this issue Jun 1, 2023 · 3 comments
Closed

Hugo watch (-w) without server injects livereload.js that is unreachable #11061

istr opened this issue Jun 1, 2023 · 3 comments

Comments

@istr
Copy link

istr commented Jun 1, 2023

What version of Hugo are you using (hugo version)?

$ hugo version
hugo v0.112.6-2ca0fcc4485c74859382ffab4abf8610cdd3771a+extended linux/amd64 BuildDate=2023-06-01T09:03:29Z VendorInfo=gohugoio

Does this issue reproduce with the latest release?

Yes

Scenario

Run hugo -w (not in server mode) along with caddy for local testing to overcome the current limitation that hugo server does not yet provide HTTPS (see #4883).

Observed behavior

When running hugo in build mode with the -w option, but without server, the livereload script

<script src="/livereload.js?mindelay=10&amp;v=2&amp;port=&amp;path=livereload" data-no-instant defer></script>

is injected anyway. However, this is not usable since hugo -w does not expose it when not in server mode.
The --liveReloadPort int and --disableLiveReload options are only available for hugo server but not for hugo -w.

Expected behavior

When running hugo -w the livereload script is not injected.

Alternative behavior

When running hugo -w the livereload function behaves the same as in server mode but the server only serves the livereload hook:

  • hugo -w livereload enabled, script injected, server started for livereload only
  • hugo -w --disableLiveReload no script injection, no livereload listener
  • hugo -w --liveReloadPort int script injection, server started for livereload only, connect to other port
@jmooring
Copy link
Member

jmooring commented Jun 1, 2023

Confirmed.

This worked as desired in v0.111.3. It stopped working as desired in v0.112.0.

@jmooring
Copy link
Member

jmooring commented Jun 1, 2023

You may be able to use this instead:

hugo server --renderToDisk --disableLiveReload --baseURL "https://example.org/"

@bep bep removed the NeedsTriage label Jun 2, 2023
@bep bep added this to the v0.112.7 milestone Jun 2, 2023
bep added a commit to bep/hugo that referenced this issue Jun 2, 2023
@bep bep closed this as completed in a191b38 Jun 2, 2023
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants