Hacker News new | ask | show | jobs
by jayroh 1396 days ago
If anyone on the team at GitHub who built this site sees this --

Heads up, that page has no `<title>` tag so the browser tab is `githubnext.com/`. That is a _VERY_ minor nit, but still an SEO ding (you're github, that doesn't matter much), and a rough edge that could be buffed out.

Bonus points for adding a favicon too. :)

7 comments

> That is a _VERY_ minor nit

Well, the title is precisely the only mandatory element in a valid HTML5 document, even if forgetting it seems harmless.

Long time ago I read/skimmed the specification, but I think the DOCTYPE preamble is the only _required_ element in a HTML5 document. The specification allows you to omit <head/> if it's empty, and if that's allowed, then it should be allowed to not having any <title/> elements as well.

Edit with details from https://www.w3.org/TR/2014/REC-html5-20141028/document-metad...

> Note: The title element is a required child in most situations, but when a higher-level protocol provides title information, e.g. in the Subject line of an e-mail when HTML is used as an e-mail authoring format, the title element can be omitted.

From https://www.w3.org/TR/2014/REC-html5-20141028/document-metad...

> If it's reasonable for the Document to have no title, then the title element is probably not required. See the head element's content model for a description of when the element is required.

So strictly speaking, if it's meant to be used as a traditional web page, you should really have it (obviously), but it's not strictly required.

It’s not that you’re allowed to omit the head element (you’re not, and you can’t), but that its start and end tags are optional. Same with the html and body elements. (These remarks apply to HTML syntax only; in XML syntax, which is certainly still a thing, you can (if you care not for validity) omit whatever elements you choose to, only needing some root element.)

As far as sources are concerned, the HTML spec is maintained by WHATWG, not W3C. The relevant citations start at https://html.spec.whatwg.org/multipage/semantics.html#docume....

The normative reference on the necessity of <title> is in the content model for the head element:

> If the document is an `iframe srcdoc` document or if title information is available from a higher-level protocol: Zero or more elements of metadata content, of which no more than one is a `title` element and no more than one is a `base` element.

> Otherwise: One or more elements of metadata content, of which exactly one is a `title` element and no more than one is a `base` element.

For the rest, you’re correct: the DOCTYPE is the only always-mandatory thing in a valid HTML document.

> It’s not that you’re allowed to omit the head element (you’re not, and you can’t), but that its start and end tags are optional.

That’s like calling a cheese sandwich without any cheese a cheese sandwich.

It's not a sandwich recipe. The bread doesn't matter. The cheese does.
If you omit writing <head> and </head> in HTML syntax, there will still be a head tag in the parsed result.

(This is different from XML syntax, where omitting the start and end tags means omitting the element as a whole so that there will be no head tag in the parsed result.)

I think they are saying HTML implies the <head> for you - the <title> is still required.
convo was about HTML 5 specifically (the W3C version). I've never heard HTML WHATWG called HTML 5.
> I've never heard HTML WHATWG called HTML 5.

Directly from the specification:

> 1.2 Is this HTML5?

> In short: Yes.

https://html.spec.whatwg.org/multipage/introduction.html#is-...?

From the head element section mentioned:

> If the document is an iframe srcdoc document or if title information is available from a higher-level protocol: Zero or more elements of metadata content, of which no more than one is a title element […].

> Otherwise: One or more elements of metadata content, of which exactly one is a title element […].

So it is required, not just suggested, for a web page, but not for all kinds of html documents; TIL. The parser still tries to parse head contents before body contents even if you omit the head tags, so a doctype followed by title is the shortest valid full page.

I didn't mention the doctype because I believe it isn't strictly speaking an element, just a preamble, but you're right, it's required as well.

> I didn't mention the doctype because I believe it isn't strictly speaking an element, just a preamble, but you're right, it's required as well.

Funny thing, when I read “the only mandatory element in a valid HTML5 document”, I interpreted “element” in its generic English sense (piece, thing) rather than its HTML sense (node of type element, as distinct from text/comment/doctype/other-types-only-found-in-XML-syntax nodes).

True, I guess I would too if I were a native English speaker. Even when the words are almost identical in my language, I read them as programming jargon before plain English.
Not only that, but it appears their DNS settings are a bit funky as well:

  $ dig githubnext.com
  
  ; <<>> DiG 9.11.3-1ubuntu1.17-Ubuntu <<>> githubnext.com
  ;; global options: +cmd
  ;; Got answer:
  ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 29398
  ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
  
  ;; OPT PSEUDOSECTION:
  ; EDNS: version: 0, flags:; udp: 65494
  ;; QUESTION SECTION:
  ;githubnext.com.                        IN      A
  
  ;; Query time: 1458 msec
  ;; SERVER: 127.0.0.53#53(127.0.0.53)
  ;; WHEN: Fri Aug 26 17:20:13 CEST 2022
  ;; MSG SIZE  rcvd: 43
I noticed that twitter.com also has no <title> tag, the title gets set once the JS loads. Kinda surprising to me that such a popular site like Twitter doesn't have such a basic HTML tag.
It's also horribly bloated. Just scrolling on my modern Android smartphone makes it lag and drop to like 5 FPS.
Favicon is there, it just happens to be light grey. I guess someone only tested this one on a browser in dark mode.
This is minor compared to all the new websites that use div's for link and button tags.
Hey! Thanks for the report, we're on it :D
No problem! :)

Glad to help