html icon indicating copy to clipboard operation
html copied to clipboard

Feature Request: Adding a <tail> to HTML documents

Open gja opened this issue 8 years ago • 11 comments

The html <head> is the correct place to put metadata about an html document. This metadata comes in two categories

  1. Content that affects the rendering of the document (such as meta name=viewport, inclusions of critical CSS, and title)
  2. Content that doesn't affect the rendering of the document, and is primarily used by bots and other non-browser entities (such as og tags, meta descriptions, keywords, structured data, etc...)

The first few packets of an HTML response are the most important on a slow network, and it would be good to have a way to have items from category 1 in the head, but move items in category 2 elsewhere.

Thus, a <tail> tag would be complimentary to the <head> tag. This tag would be ignored by browsers, and only used by bots when searching for metadata.

gja avatar Jan 06 '18 07:01 gja

thanks

taweesakteejantuk66 avatar Jan 06 '18 10:01 taweesakteejantuk66

Heya, I recommend reading through https://whatwg.org/faq#adding-new-features and https://whatwg.org/working-mode to get a general idea of how things go here.

It's not entirely clear to me why this would be needed as you can already include <meta name> elements inside <body> I believe.

annevk avatar Jan 06 '18 11:01 annevk

Hi, thanks for the feedback, will go through that document.

However, to your second point, meta tags are not allowed inside the <body>, unless they have an itemProp (unless I am misreading this standard): https://html.spec.whatwg.org/multipage/semantics.html#the-meta-element

gja avatar Jan 07 '18 11:01 gja

Also, to make this worse, Facebook's OG tags are not <meta name>, they are <meta property>

gja avatar Jan 07 '18 11:01 gja

https://checker.html5.org/ seems to allow <meta property> in <body> (I'm probably wrong on <meta name>), but l don't know where that is defined as HTML doesn't define that attribute.

cc @sideshowbarker

annevk avatar Jan 07 '18 11:01 annevk

(I'm probably wrong on ), but l don't know where that is defined as HTML doesn't define that attribute. - @annevk

:thinking: https://html.spec.whatwg.org/multipage/semantics.html#attr-meta-name

snuggs avatar Jan 08 '18 13:01 snuggs

It defines name, but not property.

annevk avatar Jan 08 '18 13:01 annevk

Oh wow <meta property> does work on https://checker.html5.org I didn't expect that. Hadn't checked.

snuggs avatar Jan 10 '18 11:01 snuggs

@annevk @snuggs AFAIK [property] is defined as a part of RDFa standard.

Comandeer avatar Jan 10 '18 11:01 Comandeer

https://checker.html5.org/ seems to allow <meta property> in <body>

AFAIK [property] is defined as a part of RDFa standard.

Yeah, more specifically as part of HTML+RDFa https://www.w3.org/TR/html-rdfa/

The RDFa Lite subset of the RDFa attributes was reluctantly made allowed in the HTML Checker backend mostly because the practical reality is that many web documents use Facebook Open Graph markup, which relies on the property attribute.

sideshowbarker avatar Jan 11 '18 11:01 sideshowbarker

It's not entirely clear to me why this would be needed as you can already include <meta name> elements inside <body> I believe.

I think it's needed for some of same reasons we need a <head>. We don't put the <head> content inside the body at the top of the body with <meta name> even if it's a resource load that could be placed there. This is because the body is for semantic representation of visible content, not resource loading, metadata, etc.

Some of this non-body content belongs in the head because we want it to be read first by humans or by computers, or because it is rendered above the page like <title>, but some of it doesn't need to be there and would be better at the end of the HTML document after the body, because for some types of non-body content it's better for humans and/or computers to read the body first.

For example, we often want to defer the loading of resources like script.js, which can be done in the head with the "defer" attribute, but many prefer to have these deferred resources at the bottom of the page, because they find it more intuitive or because it reduce clutter at the top of the page. So some developers put scripts etc at the end of the body, but it's not really part of the body because it's generally a resource load, not a semantic representation of the visible content.

It can also create distracting clutter in the head to have things in the head that we don't wish to be read (by a human or computer) prior to the body. But if we put the in the body instead, it's confusing and not consistent with the semantics, which is one of the reasons it's often put in the <head>.

The most logical or semantic place to put this type of content for now would be in the no-man's land after the end of the </body> tag but before the closing </html> tag. This space is currently unused though because it's out of spec etc, and would look a bit messy, disorganised and asymmetrical without a wrapper.

It'd be very nice to have a third section after <head> and <body> called something like <tail>, <foot>, <end> or <bottom> to wrap and define this no man's land for things that aren't in the body of the page (aren't semantic representations of the visible content), but also don't really belong in the "head" in terms of the order in which we want them read by humans or computers, and so would be better placed at the bottom of the page after the body than in the head, if we had an appropriate wrapper element for them.

For now, I might have to just ignore the spec and try using:

<tail style="display:none">
<!-- stuff -->
</tail>

but it'd be much nicer to have something like this in spec eventually.

alecgargett avatar Aug 26 '24 04:08 alecgargett