No <head> and </head> tag generated, only its contents

Hi,
i noticed my pages had no tags in their code source, despite the baseof.html and home.html templates having them.
I verified in public version, server version and on netlify, none have them, so they’re just not included by hugo for some reason. It doesn’t seem legal html-wise.

<!DOCTYPE html>
<html lang="{{ default site.Language.Lang site.LanguageCode  }}" dir="{{ default "ltr" site.Language.LanguageDirection }}">
<head>
  {{ partial "docs/html-head" . }}
  {{ partial "docs/inject/head" . }}
  <title>{{ site.Title }}</title>
</head>

Beginning of sample’s homepage’s source: <!doctype html><html lang=en-us dir=ltr><meta name=generator content="Hugo 0.108.0"><script src="/livereload.js?mindelay=10&v=2&port=1313&path=livereload" data-no-instant defer></script><meta charset=utf-8><meta
I didn’t write the first meta tag and script so it seems automatic, but then it jumps right to the start of html-head.html.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/head#technical_summary

The start tag may be omitted if the first thing inside the <head> element is an element.

The end tag may be omitted if the first thing following the <head> element is not a space character or a comment.

You are running hugo with the --minify flag, so the wrapping head element is removed.

1 Like

Oh, I didn’t know that was legal. Ok
So google analytics isn’t complaining about that… Thanks

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.