3 ms·
I don't get it. The big problem with the old meta tags is that nobody follows standards[1], and they were frequently abused to misrepresent the document in a fa
by marginalia_nu 4y ago
I don't get it. The big problem with the old meta tags is that nobody follows standards[1], and they were frequently abused to misrepresent the document in a favorable way (especially keywords and description).
How would this help alleviate those problems?
[1] To this day. I've learned, from building a parser for my search engine, you can't just select the <title> tag if you want the title of a page. You need to select the title tag in the <head>-tag. Otherwise you'll get the title-tags people semi-regularly use in the body as well... Like not just hobbyists. Found a major American university that used title-tags to wrap navigational links.
- soneil 4y agoI keep finding these when I least expect it and they've been fantastic every time - it usually means whatever I'm trying to automate is 90% solved for me. Scraping recipes from the bbc, flight reservations from my email, etc. If something includes schema.org/RsvpAction it probably needs to be actioned, if something contains schema.org/DiscountOffer it can probably go in the Noise folder. If someone starts sending spam containing flight reservation meta I'm going to be so sorely disappointed in the human race.
- marginalia_nu 4y agoI've gotten spam calendar appointments that my email client has helpfully added to my calendar so that I'm helpfully reminded of their spam sometime in the future with a push notification.
- logisticpeach 4y agoGood grief that has to be confusing. I'm often temporarily baffled by legit entries when notified, letalone strange or unexpected spam entries :)
- myfonj 4y agoPlus <title> tag is valid in SVG context, where it does what `title` attribute does on HTML elements (provides content for HTML tooltips and screen readers). And since inline SVG is valid in HTML, you can get valid title tags (from SVG namespace) outside HEAD element Plus if there wasn't TITLE in the head and is encountered inside BODY (not valid), it is adopted into the HEAD from document object model's perspective as if it was hoisted there (but it is not, just its value): data:text/html;charset=utf-8,<head> <!-- <title>not here</title> --> </head> <body bgcolor=dimgray> <svg viewbox="0 -15 80 20" fill=cyan> <title>SVG Tooltip</title> <text>Some SVG<text> </svg> <title>Title For Adoption.</title> <title>Second late title.</title> <p>And the title is: »<output id=o></output>«. <body onload="o.value = document.title"> <body text=snow> Resulting paragraph reads: "And the title is: »Title For Adoption.«." ("Yet unseen attributes" of the consecutive BODY tags are physically "hoisted" to real body node, but it's a different chapter.) Plus both <head> / </head> tags are optional — and implied — so "selecting title in head tag" can become very hard task, if taken seriously. Making HTML parser ain't easy.
- chrismorgan 4y agoYou complicate the description and make it sound much harder than it actually is. Concerning HTML parsing in general: it is easy, genuinely easy, one of the easier things to implement, because it’s well-defined, and in a format that matches the implementation. You’re basically just translating the algorithm from pseudocode into code. Sure, it’s long, but it’s not hard. <head> and </head> being optional is purely a parser concern, that the start and end tags are optional. Implement the parser, and you get that behaviour automatically, and nothing beyond that needs to worry about it at all. For that matter, you don’t need to worry about head or body in determining the title, because here’s how the document title is actually determined, per https://html.spec.whatwg.org/multipage/dom.html#the-title-element-2 https://html.spec.whatwg.org/multipage/dom.html#the-title-el...: > The title element of a document is the first title element in the document (in tree order), if there is one, or null otherwise. (And then it goes on to describe further processing done for the document.title attribute.) The only subtlety in this explanation is that when it speaks of title elements, it’s speaking of HTML title elements only. There’s nothing complicated or difficult about this. There’s no adoption, it’s just taking the first HTML title anywhere in the document. (If implementing this in browser JavaScript, you can’t just use document.querySelector("title") because it ignores namespaces. The most efficient way will be to use document.evaluate() with an XPath like "//title/text()" which matches the required child text content nodes.)
- myfonj 4y agoI'm not sure if I follow your line of thoughts correctly. I agree that yes, HTML parsing is well defined in current standard, but (subjectively, for me) it is far from "easy", given the amount of states and back-compat "burden" with plenty of often overlooked exceptions. (I like to explore them but I'd never try to make a compliant HTML parser from scratch, probably.) I was in fact responding to > […] I've learned, from building a [HTML] parser […] you need to select the title tag in the <head>-tag. what gave me impression OP really rolls his own HTML parser and relies on some possibly dangerous assumptions that are not in fact granted (however well defined) by the specs — for me one of such assumption is especially "HTML parsing is easy" / "I understand HTML well enough to parse it myself" — and wanted to point out possible further gotchas wrt "selecting the <head>-tag" (e.g. that it may be hard when there is no <head> tags) or that "selecting the first title tag" could possibly not give the right one. But maybe I'm just little slow and all those "Idiosyncrasies of the HTML parser" [1] are notoriously known. And sure, many scenarios could be waved out as unimportant border-cases, maybe. --- As for querying the document, i.e. having the state when the document is ready and "something" did the parsing and tree heavy lifting for us (so we have DOM and JS) we can surely reach for ancient namespaced document.getElementsByTagNameNS("http://www.w3.org/1999/xhtml", "title")[0]?.textContent?.trim() (hopefully there are no further details wrt comments, white-space normalization and entity expansion on top of raw textContent we should take care of) but it makes very little sense when there is `document.title` for this exact purpose. --- [1] https://htmlparser.info/parser/ https://htmlparser.info/parser/
- gnlrtntv 4y agoI think these things are very related, but Microformats isn't going to solve this problem on its own. After all, it's been around for quite a while, just like most of these conventions. 10-15 years ago, we had a bunch of different ways everyone was trying to schematize their data on the web, and since we never all agreed to just use one of them, everyone now uses fragments of all of them — and of other pseudo-proprietary systems — in their own unique ways.
- epeus 4y agoIndeed - every silo wants you to use their own specific markup, but even then they choose what to show. I made a post a while back that gave a different summary on every silo platform https://www.kevinmarks.com/partialsilos.html https://www.kevinmarks.com/partialsilos.html Of course, since then some of the silos have died or given up on their own systems, but microformats remains useful if you want to co-operate.