Live reload injecting in weird place

In the documentation, it says…

Hugo injects the LiveReload <script> before the closing </body> in your templates and will therefore not work if this tag is not present.

But mine is injecting after <head> for some reason, and I’m trying to figure out why.

<!DOCTYPE html> 
<html lang="en-US"> 
<head><script src="[/livereload.js?port=1313&mindelay=10&v=2](view-source:http://localhost:1313/livereload.js?port=1313&mindelay=10&v=2)" data-no-instant defer></script> 
<meta charset="UTF-8"> 
<meta name="viewport" content="width=device-width, initial-scale=1.0">

But, I have a closing body tag.

<!DOCTYPE html>
<html lang="en-US">
{{ partial "head.html" . }}
    
    <body>
        {{ partial "header.html" . }}
        <div id="content">
        {{ block "main" . }}{{ end }}
        </div>
        {{ partial "footer.html" . }}
    </body>
</html>

It’s new default behaviour.

Since 0.64 release, Hugo Inject livereload script after <head> to fix turbolinks compability hugo/8f08cdd.

Yes, the documentation need to be revised.

Thanks for the information, I had just updated hugo to .72. Guess I should have looked at the notes/logs. But I’m fairly sure I was on .71 before. Maybe I was using an old template that I had tweaked?

If I load a old template though, it goes back to the bottom. So what controls the placement? I’d line to drop it a line if possible. My OCD when cleaning up the html just sees it injecting right at the back of the head tag.

Please point me to the erroneous documentation. I can’t find it.

not golang programmer, but my guess because hugo only match the <head> and <HEAD> to inject the livereload script.

when you have some some attributes on the <head> tag like <head data-head="head-value"> Hugo will inject at </body> or </BODY>.

@jmooring this one, Hugo/Usage

Hugo injects the LiveReload <script> before the closing </body> in your templates and will therefore not work if this tag is not present.

I was looking to confirm that it’s supposed to be injected in the start of the head tags now, and then I planned to commit a change to the docs since that appears to be outdated.

Thanks.